0
0

Hi!

I’m new to FMOD but have previous experiences with Unity. When I want to play a sound one time from an object I can use 2 methods:

RuntimeManager.PlayOneShotAttached(fmodEvent, gameObject);

or

FMOD.Studio.EventInstance instance = RuntimeManager.CreateInstance(fmodEvent);
RuntimeManager.AttachInstanceToGameObject(instance, gameObject, GetComponent());

They should be exactly the same but the first one I can clearly notice the spacial sound and on the second it is almost 2D sound, much louder. Why is that? Did I do something wrong?

  • You must to post comments
0
0

There should not be any difference as PlayOneShotAttached actually calls AttachInstanceToGameObject to set the position of the event. Although, if you aren’t playing the event immediately after attaching the Instance the position will not be correct.
The RuntimeManager keeps a list of instances that are attached to gameObjects, if an event stops playing (or does not start straight away) it will get removed from the list and not updated.

If you wanted to do what PlayOneShotAttached does, it would be along the lines of:

FMOD.Studio.EventInstance instance = RuntimeManager.CreateInstance(fmodEvent);
RuntimeManager.AttachInstanceToGameObject(instance, gameObject.transform, GetComponent());
instance.start();
instance.release();

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.