- Home /
Final score in new scene
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 ""
sorry, I forgot to write a piece. The error which gives me is the following: "Assets/Script/SCHER$$anonymous$$ATA1.js(11,14): BCE0019: 'totalScore' is not a member of 'UnityEngine.Score'. "
Click "more" then "Edit" to put that in the post rather than the comments.
Can you put up the relevant lines from SCHER$$anonymous$$ATA1.js?
there is code of SCHER$$anonymous$$ATA1.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;
}
Answer by chucky831 · Dec 21, 2012 at 10:08 AM
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;
}
"$$anonymous$$ore", "Edit", then cut/paste all that code into the window that pops up when you hit the '101010' button at the top.
The error is on Line 11, Character 14 of SCHER$$anonymous$$A, which means it's in that //CODE
bit. I need line 11 and it's context.
Your answer
Follow this Question
Related Questions
Loading a scene and keeping original score 3 Answers
How to create a point/score system based on player performance. 2 Answers
1st time to use Unity can help me with this simple project? 0 Answers
Script: import a 3d model to the scene from an outside folder 2 Answers
making and integrating Visual novel element in 3d game? 2 Answers