- Home /
Getting all Object to go next scene.
I have 4 object to destroy. But i need to program when the player gets only 2 object he need to go back to get the other 2 object left. I hope someone could help me. Thanks ...
Answer by Berenger · Feb 01, 2012 at 04:49 PM
Look over here : http://unity3d.com/support/documentation/ScriptReference/Object.DontDestroyOnLoad.html
Create a new scene, save it and name it "a". Create an empty game object, and attach the following script (js):
var pouet : int = 0;
function Awake (){ DontDestroyOnLoad(gameObject); }
function Update(){
if( Input.Get$$anonymous$$eyUp("space") ) print( ++pouet );
if( Input.Get$$anonymous$$eyUp($$anonymous$$eyCode.Escape) ) Application.LoadLevel("b");
}
Save, then save as and name it "b". File-> Build setting, add the scene a and b. Reopen the scene a, run, play around with the key space and watch the output. Press escape, and play again with space.
This is my script..
function OnTriggerEnter (other : Collider) { if(other.gameObject.tag== "p1") { Destroy(other.gameObject); score +=50; scoretxt.text = score.ToString(); print(score); gameObject.Find("Balisong").GetComponent("GUITexture").enabled = true; }
AND.. I don't know how to groin the script { DontDestroyOnLoad(gameObject); }
please help me ..
Actually,that is my code in destroy object with equivalent score then i want is when he did not destroy that object the player cannot proceed next level. And actually i have 4 object. $$anonymous$$y question is how can i use your answer using my destroy script.? Thanks
Your answer
Follow this Question
Related Questions
NullReferenceException - When destroying Object 1 Answer
Remove object based on its position alone 1 Answer
Dispose Object in IOS 0 Answers
Destroy the current GameObject? 7 Answers
Can't proceed next level when the object destroy not complete. 2 Answers