- Home /
Scripts of Objects which I've deleted through the editor still exist and are run
I created an environment. Not too big but not too small. I created a new scene but needed the same environment. So I created a prefab and implemented it in a new scene. I detached the prefab, because I wanted to build further on the environment in this scene.
Strange stuff started to happen. The editor told me "the referenced script on this Behaviour is missing!" 3 times, all on the same object. If I click on it there is no script missing, plus there is a selection animation from Unity, which looks like is working on a misplaced line. See the next picture.
But I ignored it, since my game was still running fine. Just about an hour ago I noticed all my prefab bindings in the environment were gone as well. So I tried to rebind the environment. Then Unity placed an entire new instance of the environment in the scene. I was surprised. I deleted it again, and noticed more strange stuff happening.
Somewhere in the code I start an AudioSource. Before this last event it worked normal. Now it still works normal but also throws a new warning:
But, there is no disabled audio source. There is only a single audio source in the entire scene, and it's enabled!
On top of that, it works, everything goes as normal, the audio plays. So I placed a Debug.Log on the line before it to see if it get's called multiple times, and it printed 3 times! I then Cut/Pasted the Debug line into the contructor, and also there it got called 3 times!
Then my Unity started really freaking out. It threw and enourmous pile of errors including saying me wanting to start an audio source which was already destroyed. Remember: I changed nothing in the code except for the Debug lines.
I decided to reboot my Unity, and now I am back at the AudioSource warning.
Does anyone know what the f is happening? I can't have this: Unity messing up my work. Stuff in the environment isn't responding anymore and I can't find out what is causing this. Does anyone have any clue what is happening?
Thanks in advance.
Your answer
Follow this Question
Related Questions
Making a cloned particle emitter fire once only 2 Answers
Can prefabs drop attached scripts? 0 Answers
big script vs many scripts 1 Answer
Prefabs wont disapear 5 Answers
Do scripts get cloned with prefabs? 2 Answers