- Home /
results screen using destroyed objects as score
my game has enemies who's A.I. scripts are disables upon a trigger enter. when this happens they are still... and dead. on the same trigger i have a cue animation script that sends a cube that is located in the upper left hand corner (to represent a killed enemy) up into another trigger that destroys it on trigger enter. i did this so my enemy's would still lay around the area and i could add a script that basically checks to see if items with "tag" are still present in the scene. if the search yeilds null then it loads a new scene. so my question is... in the new scene, how can i take the cubes that were destroyed and have them appear in the new scene... as if to say... you were able to kill [] [] [] [] [] before the time ran out?
Answer by jaakaappi · Jul 12, 2013 at 07:20 PM
http://docs.unity3d.com/Documentation/ScriptReference/Object.DontDestroyOnLoad.html
This makes the gameobjects stay where they are when you load a new scene by not destroying them.
http://docs.unity3d.com/Documentation/ScriptReference/Application-isLoadingLevel.html
This is a boolean that is true if the game is loading a new scene.
http://docs.unity3d.com/Documentation/ScriptReference/Application-loadedLevel.html
Aand this one tells the index of the level that is currently loaded. By combining these three you can make your gameobjects survive the otherwise fatal scene loading and re-position themselves after a new scene has been loaded.
In case you have any further questions please add a comment and I'll try to answer.
Your answer
Follow this Question
Related Questions
Creating and destroying password stage between scenes 0 Answers
How to make a saved score destroy on load new scene 0 Answers
Destroy(gameObject) destroys entire scene 1 Answer
Destroy gameobject when THIS scene is loaded 1 Answer
Make music play across scenes but destroy when it returns to beginning scene. 1 Answer