Playing 2D animation over a Game Over dialog

I have a 2D animation I would like to play over my Game Over dialog, such that when the animation completes (and closes) the Game Over dialog is revealed.

I’m learning Unity, does anyone have a tutorial they can share with me, or advice on how to do it?

I’ve been able to get it working however the animation displays behind the dialog. I think I need to add a component but i’m not sure what one


Hi ! You can use AnimationEvents

Basically you have to put an animation event on the animation window, on the selected animation clip. And there you can call a function of a script attached to that gameobjects.

So you can add at the end of the animation ( or maybe one frame before, sometimes unity has a bug and doesn’t call an event on the last frame) and there call a function which reveals the GameOver dialog.


Hope it helps, cheers !

Hi @guido-paglie thanks for the info, I’ve read the doco and watched the vid but am still struggling…

Fyi this is the animation (‘Explosion’) I’m trying to display over my dialog (‘WinPanel’):!/content/66932

(I’m using the Explosion prefab that comes with the asset.)

Rather than calling WinPanel from an event in Explosion, I’d just like to activate both at the same time from my script using:

I’ve got this working but still can’t get Explosion to display over WinPanel despite ordering them correctly in the Hierarchy, in the image below I show the Inspector for Explosion:

In the next image I show the Inspector for Explosion > ExpAnimator. You can see it has an image assigned which does display over WinPanel, however its child images (Fire, Shrapnel, Smoke, Light) do not. These are the images that form the animation.

Any ideas what I’m doing wrong? thanks