- Home /
How can I get the value from other scene?
I have to make a retry function.I make a value in main menu to save which scene the player is playing. But i have no idea how to get the value in the main menu and use this value to detect which scene is the player lose.
Answer by crazyKnight · May 11, 2011 at 12:01 PM
you can try playerprefs link text or u can create a static var int and store the current level number(when the player lose) in it and then check it in the main menu .
I have try this way but the system cann't detext the var from other scene.I set the var to saeve the current level as a int in main menu scene.
well it works perfect for me,make sure that both the scripts are in the same folder if it still doesn't work out then try using playerprefs it is very easy to use and you can save your level number even if the application is closed with playerprefs
Answer by FLASHDENMARK · May 11, 2011 at 11:23 AM
I think you want DontDestroyOnLoad?
Sorry,i don't understand how to use this function. I have type this code in $$anonymous$$ain $$anonymous$$enu scene. But how to take the var in retry scene??
Your answer
Follow this Question
Related Questions
changing variables values !! 1 Answer
Variable won't update within a certain function 0 Answers
why can´t set value in own function? 1 Answer
Access a class on another script? 1 Answer