Hello i got a problem. I want to display player score that is in a scene. And i want to acces that script from antoher script in another scene just to display the score.
This is the class i want to inherit from:
public float scoreCalculation(){
score = 1;
random = random + Random.Range(min,max);
score =+ random + addScore;
return score;
}
public float getScore(){
float pScore = score;
return pScore;
}
And this is the class that i want to display the score in another scene.
public class guiDead : MonoBehaviour {
public GUIStyle style,style2;
public player score;
private float displayScore;
void start(){
score = GetComponentInParent<player>();
displayScore = score.getScore();
}
void OnGUI(){
GUI.Box(new Rect(200,200,200,200),"Sorry you died
Your Score: " + displayScore,style);
if(GUI.Button(new Rect(200,450,100,100),"Retry",style2)){
Application.LoadLevel(1);
}
}
}
Can you guys please help me?