Nevermind guys. Sorry… just figured out how to do:
On first scene: (attached to some gameobject)
static var x: int = 20;
function Awake () {
DontDestroyOnLoad (transform.gameObject);
}
on the next scene:
function Awake () {
print(GameObject.Find("SomeName").GetComponent("SomeScript").x);
}
Thank you.
appels
2
put this on the object in a script to keep it alive upon new scene load:
function Awake () {
DontDestroyOnLoad (this);
}
you can read it’s static value from another object by referencing it :
print(GameObject.Find(“myOtherGameObject”).height);
untested, may contain typos
=/ I wasn’t fast enough to edit…
Thanks appels that’s almost exactly what i needed, you just forgot the getcomponent though.