Hey guys ive been kinda stuck for a couple days now
i got SceneLevel1 with a script called ScoreLevel1,js
in ScoreLevel1.js i got a variable
#pragma strict
public static var score : int = 0;
public var scoreText : GUIText;
function Start () { }
function OnTriggerEnter(obj :
Collider){ if(obj.gameObject.tag == “Points” && !ch_ControllerJS.score)
{ if(score < 3 ) { Destroy(obj.gameObject); score += 1; scoreText.text = "Stars : " + score; print("Star Collected"); } else { Destroy(obj.gameObject); scoreText.text = "Stars : " + score; print("Already collect 3 Stars on this Level"); score = 3; } }
}
function Update () {
score = score;
}
I want to get the value of
function Update
score = score;
And Show it on another scene with a diferent script
this is what ive tried but unsucefully
#pragma strict
function Start () {
}
function Update () {
var ScoreLevel1: ScoreLevel1 =
GetComponent(score);score = score; }
its the first example on http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html