|
hi guys, i want to pass a boolean variable from a scene into another scene. when am trying to load into previous scene the properties for the variables are destroying? how can i avoid this? i have already used DontDestroyOnLoad(this); but its not seems good... is this any chance to pass variables with DontDestroyOnLoad function....? can any one help me?
(comments are locked)
|
|
Use DontDestroyOnLoad(gameObject); to keep the GameObject the script is on alive Alternatively, you could make the boolean value static, so it persists no matter whether the script is destroyed or not, but that'll stop you from being able to assign to it in the inspector hmmm its correct mike....but i have already tried this, but the problem which i got is,the OnGUI() elements also displayed in to the next scene.(ie. all those properties got alive). thats why am asking as particularly how to make a variable as alive?
Nov 08 '10 at 01:06 PM
sriram90
make the boolean static instead so you can access it from any scene without even putting the script in the scene itself (ScriptName.variableName = true; etc)
Nov 08 '10 at 01:51 PM
Mike 3
(comments are locked)
|
