Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Tweaking screen transitions not to fire every time

Discussion in 'Animation' started by Tigro, Dec 16, 2020.

  1. Tigro

    Tigro

    Joined:
    Apr 25, 2014
    Posts:
    58
    I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).



    This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.

    How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene?
     
  2. Tigro

    Tigro

    Joined:
    Apr 25, 2014
    Posts:
    58
    No ideas? :(
     
  3. Tigro

    Tigro

    Joined:
    Apr 25, 2014
    Posts:
    58
    Maybe there's some way to pass some kind of a parameter when loading a new scene? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts.
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    I can't think of a straightforward way to do what you want off the top of my head with Animator Controllers, but you might be interested in Animancer (link in my signature) which lets you control all your animations in scripts so you can play or not play them based on whatever logic you want.
     
    Tigro likes this.
  5. Tigro

    Tigro

    Joined:
    Apr 25, 2014
    Posts:
    58
    I see, thank you. Will give Animancer a look, though I'd hoped there'd be an easy way of doing this with vanilla Unity :(