- Home /
Prefab is lost in between
Hello Unity People!
In my scene there are rooms. Each room is enable/disabled, in it's turn, but they all have the same prefab in their hierarchy - Elevator with animation and audio source. The Elevator is an instance in each of the "rooms" and is also turned on/off.
Now I have a problem, after the first room is played the animation and sound,in the next room I get an error that I'm trying to play audio that is turned off. But It's turned on the second the next room is enabled.
Could that be that because the sound is "interrupted" while playing I get an error? I understand that if it's a prefab and I assign it from the project and not the hierarchy it should work right?
EDIT: Also when I look at the prefab's animator component it says: animator is not been initialized.
Answer by HawkSandwich · Jun 16, 2017 at 09:51 AM
Heya :)
No, assigning the prefab from the project won't work, because it's not an object that can be acted on in the game. You might think that calling something on the prefab would just do that thing for all instances, but that's not the case.
You'd need to get a reference for the elevator in the scene (or the hierarchy).