You are about to write a code to keep score. There are several controls, so we split the code. In the event of a collision
scoreSum man = GameObject.Find("scoreManager").GetComponent <scoreSum>();
man.score ++;
I used to increase the score, and in the code scoreSum, I defined the text Sc and
void Start()
{
score = 0;
}
void Update ()
{
Sc.text = score.ToString();
}
This is how you continue to display your scores. However, the score is not initialized, and even if the score does not go up during the game, the score will not be displayed at once until the game is over and back to the game window. How should I fix it?
unity
Is it correct that the text called Sc is well connected to the GameObject?
Isn't Text not connected well to Sc like the attached image?
© 2025 OneMinuteCode. All rights reserved.