4.6 Simple "Game Over" text animation not working

I am trying to make “Game Over” fade in when the player dies in a game I am making. Everything seems to work properly except the text that displays is incorrect. I have “Game Over” in the text field of the text object, but as soon as the game starts, the text gets changed to “Score: 0” for some reason.

In addition to this, I tried to pass the Player object a reference to the GameOverText object, GetComponent, and change that text to “Game Over” in the OnDestroy() method. I logged it to confirm that the text does change from “Score: 0” to “Game Over,” but when I play the game, it still displays “Score: 0.”

I’ve uploaded a picture of the animation I made. It simply has two keys with color.a as 0 in the first and 255 in the second.

Ok, I've discovered one thing. I have a "Score" object in my "UICanvas" with my "GameOverText." "Score calls GetComponent(). Getting rid of that fixes the bug, but this confuses me. Shouldn't GetComponent() just get the Text component of "Score," not of "GameOverText"?

–

1 Answer

1

4.6 Simple “Game Over” text animation not working

You should ask about this in the Beta group, where our developers can help you and check if that’s a bug.