I want to trigger the GameOverScript when the player object is destroyed. Why I get 2 errors after putting this line? The game still runs fine even with these 2 errors. How to fix it? Thanks.
http://i453.photobucket.com/albums/qq253/ulti-killer/5-17.png~original
Link doesn’t work for me.
You’re going to have to add that script to something else. You can’t add the script to that game object because it’s been destroyed… it just doesn’t make sense to try to do that. Either you don’t destroy the game object and you just change the state somewhere else, or you add the gameover script to something else.
My approach is when the player object is destroyed, GameOverScript will attach to the parent object i.e. 3 - Foreground. The player object is the child of 3 - Foreground. So, when player object is destroyed, the 3 - Foreground doesn’t destroy. The GameOverScript still works fine and the game does not have any performance issue but why has these 2 error?
http://i453.photobucket.com/albums/qq253/ulti-killer/5-18.png~original