AttachInstanceToGameObject not moving the sound position


I’m working with unity, fmod 1.09.06 and the oculus spatializer and I have issues using AttachInstanceToGameObject.
I have isolate the problem:

  • i create the istance of the object.
  • i call the AttachInstanceToGameObject.
  • if i move the obj the sound stays where it was created.

I do this simple thing with the following lines:

eventInst = FMODUnity.RuntimeManager.CreateInstance (asset); FMODUnity.RuntimeManager.AttachInstanceToGameObject (eventInst, this.transform,this.GetComponent<Rigidbody> ());

This doesn’t move the sound while i move the object, and I also get this warning:

FMOD Studio: Instance of Event event:/04_OBJECTS/OBJ_Diorama/OBJ_Diorama_Gear_Blocked has not had EventInstance.set3DAttributes() called on it yet! UnityEngine.Debug:LogWarningFormat(String, Object[]) FMODUnity.RuntimeManager:Update() (at Assets/Plugins/FMOD/RuntimeManager.cs:412)

What am I doing wrong?

I’ve also tried using the function
eventInst.set3DAttributes (FMODUnity.RuntimeUtils.To3DAttributes (this.transform));
in the update and everything works fine, but it’s not a clean solution in my project.

Thank you for your help,


It looks like it is set up correctly, when are you calling create/attach?
I am able to get it working using the following:

public class test : Monobehaviour
public string eventName;

FMOD.Studio.EventInstance eventInst;

void Start ()
    eventInst = FMODUnity.RuntimeManager.CreateInstance(eventName);
    FMODUnity.RuntimeManager.AttachInstanceToGameObject(eventInst, this.transform, this.GetComponent<Rigidbody>());


I’ve tested your code and it’s working, so i’ve spent a few hours testing a bit more and i discovered that the problem occurs when i don’t do eventInst.start() during the same frame of the AttachInstanceToGameobject.

I recreated the error starting the event in a coroutine after a few seconds:

void Start ()
eventInst = FMODUnity.RuntimeManager.CreateInstance(eventName);
FMODUnity.RuntimeManager.AttachInstanceToGameObject(eventInst, this.transform, this.GetComponent());

private IEnumerator startCoroutine(float delay)
yield return new WaitForSeconds (delay);
eventInst.start ();


Can you try this and tell me if you have the same problem?


Normally you would need to call Set3DAttributes on an event to update its position in the world, but in the Unity wrapper we supply AttachInstanceToGameObject as a helper/replacement.

When you use AttachInstanceToGameObject, the instance is added to a list of events that have Set3DAttributes called in the RuntimeManagers Update function. To ensure that instances aren’t being updated that do not need to be, there are a few conditions that can cause an instance to be removed from the list and not have their position updated: instance.isValid(), transform == null, and playbackState == stopped.

If the event isn’t playing by the time it does the check, it will be removed from the list and not updated.


Ok, good to know.
Is there any complete documentation for the API? This problem cost me hours of work to retrieve an information that i could have had simply by reading it in the description of the metod.
The only documentation I found is this:
and i can’t find a lot of function in there, like AttachInstanceToGameObject or isValid (in fact I still don’t know what “valid” means in this contest…).
I’ve been working with FMOD for a year now, but there are a lot of basic notions that I couldn’t find anywhere. Am I missing something? Is there a more complete documentation that i’m not aware?

Anyway, thanks for your help