Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Panel animation problems

Discussion in 'UGUI & TextMesh Pro' started by Wayne-Koorts, Aug 31, 2014.

  1. Wayne-Koorts

    Wayne-Koorts

    Joined:
    Apr 14, 2013
    Posts:
    13
    I'm having some real problems here trying to do something which seems quite simple: Playing two animations when clicking a uGUI button, to swap out two panels essentially (move one off the screen to the right, move another in from the left).

    At the moment I have the two panels within a canvas, an Animator on the canvas, and two animations defined (one for moving the first panel out and the other for moving the other panel in).

    If I add an OnClick action to the button on the first panel, I can get it to play the move out animation, that part is fine. But when I add a second OnClick action to play the move in animation for the 2nd panel then it ONLY plays the 2nd animation but not the first. How can I get it to play both, in order? I don't even mind if they happen simultaneously.
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,194
    What you want to do is add the animator to each panel, when you click the button play one animation on one panel, and a different animation on the other (one slides in, the other slides out).
     
  3. Wayne-Koorts

    Wayne-Koorts

    Joined:
    Apr 14, 2013
    Posts:
    13
    Perfect, thank you!