We have a floating origin in our game, meaning that from time to time our whole world will shift back to center. There is a chance that nearby sounds are playing when this happens. Often we use RuntimeManager.AttachInstanceToGameObject and this should be no problem since those gameobjects will be moved by our origin shifter. However when we use RuntimeManager.PlayOneShot with a position I think we will start seeing issues. Is there a way to update all positions of the active one shots that are attached?
Alternatively, would it be an option to attach all oneshots to a gameobject that we will shift and use a localposition to place the oneshots in world space?
I know this is not a direct help but this kind of audio glitch is one of the reasons not to use origin-shifting form of floating origin.
I use (standard) audio in Unity with continuous floating origin and the glitches, graphical, audio, etc, don’t exist.
best of luck with the game.
Are you able to use
Theoretically that’s possible yeah. But sometimes there is no logical gameobject to attach it to. However if there would be an option to set localposition when PlayOneShotAttached is used (as an optional parameter) this would be really nice. Because then I could simply attach it to my center world object and it would simply move when the origin shifts.
Thanks for you response, but this is not a viable option for us.
At this time the integration only updates the positions of events that have been attached to objects, and
PlayOneShot is not intended to be used on events that require their position to be updated.
You could create an empty gameobject at a required position and attach the event to that.
Otherwise you could do it manually:
FMOD.Studio.EventInstance eventInst = FMODUnity.RuntimeManager.CreateInstance("");
Then use the
set3DAttributes to update the position as required.