Make animation persistent

I’ve made the following animation: Imgur: The magic of the Internet

At the beginning nothing is shown, and at the end of the animation a background image and a text that indicates if player has won/lost the game is shown.

Can I make the final state of the animator persistent? Currently it disappears when the animation finishes.

I’ve unchecked “Has exit time”, but it stills exits when anim finishes

You should make an int animation parameter called “WinningState” and then set the win/lose to 1/2 using a script, obviously setting the transition parameters to be “WinningState = X”.


See Unity - Manual: Animation Parameters.


The way I would do this would be to create a UI element for both the winning screen and the losing screen and then enable the relevant gameobject under a “complete function”


For example;

public GameObject winScreen;
public GameObject loseScreen;
private int requiredScore = 10;

private void CompleteGame(int Score) // or whatever
{

/*
* Disable components etc here.
*/

if (score < requiredScore)
   winScreen.enabled = true;
else
   loseScreen.enabled = true;
}