Hi there,
so i have a game scene with scores. in that scene i created and empty gameobject that stores the score and still remains undestroyed in the Lose game scene. my motive is to display the player score on the lose screen. Something like ‘Your score is —’. The problem is that in the text component of the score element, i put a script. that script find gameobectwith tag (“score”) (which is the object which stores the store). when i play the game it finds the object. then when in the code, i try to acces the gameobject with that tag, it shows error. here is the relevant code.
public GameObject scoreholder ;
void Awake(){
scoreholder = GameObject.FindGameObjectWithTag("Score1");
}
void Start () {
myText = GetComponent<Text>();
myText.text = "Your Score is " + scoreholder.score;
}
plz help
thanks in Advance
Note* i am a noob