passing value between two scenes

6 views
Skip to first unread message

Ruba

unread,
Nov 26, 2011, 2:20:16 PM11/26/11
to Activate3D-ICM
Hi guys,

how can I pass value between two scenes??
I've tried writing the value on a file in the first scene,then reading
it in the second scene..
but it seems like the value can't be read from the file! although I
checked when the game ended and the value I needed is written on the
file!

If anyone can help me I'll really appreciate it.

Thanks

Dan

unread,
Nov 28, 2011, 11:54:41 AM11/28/11
to Activate3D-ICM
Are you asking how to persist an object across the loading of a new
Unity scene file?

There's a static function DontDestroyOnLoad that you can call to make
a GameObject persist across scenes. Typically, applications have a
game state manager that holds data and then resets key objects after
loading a new scene. There's some more information on the function
here:
http://unity3d.com/support/documentation/ScriptReference/Object.DontDestroyOnLoad.html?from=GameObject

If that's not your question, and it's more specific to ICM, can you
clarify what information you want to persist and how you are currently
trying to store it?

Thanks,

dba

Reply all
Reply to author
Forward
0 new messages