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.
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:
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: http://www.fmod.org/documentation/#content/generated/common/introduction_web.html
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?