Hi, I have a stupid problem with the score. When I end a level I have to leave the screen a summary of the score. So to communicate between the two scripts I have been following these tips:
Script A:
var scoreManager : Score;
function Update () {
scoreManager.totalScore();
}
Script Score:
function totalScore(){
punteggio +=1;
}
The problem is that it gives me an error saying “”
there is code of SCHERMATA1.js
#pragma strict
function Start () {
}
function Update () {
}
function OnGUI () {
GUI.Label (Rect (Screen.width/2-50, Screen.height/2-25, 100, 50), “FINE LIVELLO 1”);
if (GUI.Button(Rect(10,10,80,50),"Livello 2")){
//CODE
}
GetComponent(Score).punteggio;
}
And there is code of Score.js
ar punteggio : int = 0;
function Start(){
}
function update(){
}
function OnGUI(){
GUI.Label (Rect (10, 10, 100, 20), "Score: " + punteggio); //disegno label su schermo
}
function aggiorna(){
punteggio += 1;
}