FMODAudioComponent GetOwner() should change to GetAttachmentRootActor() or GetAttachmentRoot()

Sometimes the listener will be set on the CameraComponent of ViewTarget Actor but not the Actor itself, so when the CameraComponent has some offset position with the ViewTarget, the sound will be strange!

Change GetOwner() to GetAttachmentRootActor() or GetAttachmentRoot() will be better, and should choose one of them according to the situation.

Also need to judge whether the API return nullptr in function “OnUpdateTransform” or it will crash!

I don’t think I am understanding this correctly, can you please elaborate.

The FMODAudioComponent uses PlayerController->GetAudioListenerPosition to get the position of the listener.

What situations are you referring to?

Are you referring to GetOwner() in the OnUpdateTransform?

I found in file “FMODAudioComponent.cpp”, you are using “GetOwner()” API in some function like “void UFMODAudioComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport)”.
It may be unsafe if there is three or more layer tree struct and the “FMODAudioComponent” to be the bottom layer. Such as “SceneComponent”(first layer) -> “CameraComponent”(second layer) -> “FMODAudioComponent”(third layer).
This struct may exist because UE4 Actor tree struct is actually component tree struct, with the first layer component as “RootComponent” of “Actor” and the “Actor” owns the second layer as “Owner”. But from the third layer, component can’t get the owner “Actor” from “GetOwner()” API, it will return null. The only way for all component in any layer to get the “Actor” is using “GetAttachmentRootActor()” API.
And also, sometimes you should consider get the parent component using API “GetAttachmentRoot()” to calculate the position of “FMODAudioComponent”, cause every component in the tree struct has it’s own position transform while the owner “Actor” doesn’t has any position transform but just using transform of its “RootComponent”.

So I suggest you to use “GetAttachmentRootActor()” and “GetAttachmentRoot()” API to replace “GetOwner()” API in “FMODAudioComponent.cpp”.

Thanks very much for the information, I will raise this as a task to investigate further.