C++ NewObject spawned audio component will not update its location while active

Hi everyone,

I’m currently spawning some Audio Components via C++ using NewObject.

I’m not sure if I’m missing something, but the audio component will not update its location while it is active/playing. I can update it, but only while its deactived right before I activate it.

Any insight?

Here is the code in question…

Spawning code:



UAudioComponent* LocalImpactCue = NewObject<UAudioComponent>(this, ImpactSound->GetClass());
LocalImpactCue->SetSound(ImpactSound->Sound);
LocalImpactCue->bVisualizeComponent = true;
LocalImpactCue->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetIncludingScale, NAME_None);
ImpactCues.Add(LocalImpactCue);


Updating:



						if (Beams*)
						{
							Beams*->SetBeamEndPoint(0, RV_Hit.ImpactPoint);
							Beams*->SetHiddenInGame(false);
							//ImpactCues*->SetWorldLocation(RV_Hit.Location,false,nullptr,ETeleportType::None);
							ImpactCues*->SetWorldTransform(FTransform(RV_Hit.ImpactPoint));
							if(bLasersPaused)
							{	
								ImpactCues*->Deactivate();
							}
							else
							{
								ImpactCues*->Activate();
							}
							
						}



Everything works except for the updating of the location. (And yes, the above code to set transform is called constantly while needed, and RV_Hit.ImpactPoint DOES update as well, I use it for other visual stuff). Not sure if I’m missing something?

EDIT: As soon as I post this I figured it out :frowning:
Forgot to do LocalImpactCue->RegisterComponent(); after creating it…