I’ve been creating instances of events and parenting them with AttachInstanceToGameObject()
when I initialize the scene, but I’ realizing that they don’t play any sound when they are finally triggered and I also get the error:
"...has not had EventInstance.set3DAttributes() called on it yet!"
Then I read this answer here:
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.
Does that mean that unless I start()
my instance the moment I do an AttachInstanceToGameObject()
, then it will not be updated?
And if so, does that mean that I should not be defining instances if I’m not ready to start()
them immediately?
My thought process was to initiate certain instances that will play often (e.g. door open/close) and parent them to a gameObject, so I know they will follow it and I just trigger them when needed, rather than always do a PlayOneShot()
.
But if they lose their positioning once they are stopped is making me wonder if I’m not using the defined workflow for fmod+Unity…