Search Unity

Why can't i get child UI elements to move to position 0 on the x-axis relative to its parents positi

Discussion in 'Animation' started by chunaynay, Sep 24, 2019.

  1. chunaynay

    chunaynay

    Joined:
    Jun 25, 2018
    Posts:
    3
    I've been working on creating fluid UI animations with Unity and I just ran into a problem that I've never thought would actually be an issue. I have provided a 47 second video(
    ) demonstrating the problem i have but I'll quickly explain it also.

    1. I moved a panel with five buttons (as children) out of the screen view because i want it to slide in when the game is started

    2. I want the five buttons to have a slightly delayed slide-in effect (I'm think it makes the animations look smoother)

    3. I created two keyframes for the panel (one where it's out of the screen view and another where it's exactly in the center of the screen view)

    4. I created three keyframes for each button (one where they are positioned at zero at their x-position, eg. in the center of the panel, another in the middle of the animation where the x position of the buttons are a little skewed, and a third and final keyframe where all buttons are yet again positioned at the center of the panel, or position zero at their x-position). THIS ALL LOOKS EXACTLY HOW I WANT IT TO WHEN PREVIEWING THE ANIMATION

    5. However, when I play the game all buttons seem to be off-center by a noticeable margin, and therefore not centered in the panel at all. Also the panel isn't centered at all, its like it stops right before it is supposed to stop for some reason.

    6. When I'm just dragging on the animation timeline they all end up exactly where they should be but not when playing the game so i can't for the life of me figure out what the problem is. I cant seem find anything on Google to help me
    I took a screenshot (https://imgur.com/a/SL1Wwhs) and put it into Photoshop to show you guys how off each buttons x-position is.

    I also recorded a 30 second video to demonstrate how the panel reacts in play-mode compared to when previewing. Noticed how the panel is centered when previewing but stops right before the center in play-mode (
    )

    Thank you for reading this and i hope you can help me. Also noteworthy to mention that I am very new to animations and this is my first project working with animations.
     
  2. chunaynay

    chunaynay

    Joined:
    Jun 25, 2018
    Posts:
    3
    I figured it out! u/sarvitech on Reddit told me to try and set the Exit time to 1 and it totally worked. Apparently exit time was set on 0.75 before.