PlayOneShotAttached with relative offset

Is there or will there be a way to play a oneshot that is attached to a GameObject with a relative offset?

For example, this way I wouldn’t have to create new GameObjects just to make a bullet hit sound. (I know normally you could use PlayOneShot, but my entire scene is moving, so the sound would get left behind)

I imagined it working like PlayOneShotAttached(EventReference reference, GameObject parent, Vector3 LocalOffset).

Can’t you just put that relative offset into the transform of a child gameobject and then attach the sound to that? Or does the offset need to vary?

Yeah it needs to vary, so I would need to create a lot of childs which is bad for perf

Hmm well I think the standard practice with things like this is to not create a new gameobject each time (which, as you say, isn’t performant) but rather to instantiate a pool of these gameobjects ahead of time (the size of the pool would be the maximum amount of simultaneous shots you think can happen + a few more), then with each shot you’d set the offset of a gameobject in the pool, attach the sound to that, then increment your pool index and repeat.

I think that solution would probably be a lot quicker and easier than trying to add an extra overload to the PlayOneShotAttached method

Since you’re handling event instance playback using RuntimeManager.PlayOneShotAttached(), I agree with @EdGray that pooling a number of relative offset objects is a lot easier than trying to modify RuntimeManager and create a new overload. The other alternative is to handle event instance playback and 3D attribute updating in your own script instead of using RuntimeManager, which would give you a lot more freedom as to how you provide the 3D attributes of each instance. For example, you could store each relative offset as just a Vector3, and combine it with the root object’s coordinates when you pass the 3D attribures to FMOD.