Search Unity

Question Animating A Physical Button Game Object

Discussion in 'Animation' started by LostALife, Aug 19, 2021.

  1. LostALife

    LostALife

    Joined:
    Jul 19, 2020
    Posts:
    30
    Im trying to make a physical in world button that is depressed when you click it. I have already made the code for it and that works fine. What im having trouble with is the animation. I have never animated before so this is a first.
    The problem is i have made an animation that is just a keyframe of the button being depressed and then released shortly after. Except i want to be able to put this animation on any other button i want. But when i do this the button teleports back to where the animation was made. I understand the most common answer for this is to give the object a parent. But i dont want to do this, as i have already made all my models with buttons in place and i dont want to delete them all just to duplicate one button over and over so that the parent moves to a new location. Im not really sure what to do here so i would appreciate some help.
     
  2. KalOBrien

    KalOBrien

    Administrator

    Joined:
    Apr 20, 2021
    Posts:
    89
    Hard to give decent insight as I cant see the project but on the button object make sure "Apply root motion" is unchecked in the Animator component
     
  3. LostALife

    LostALife

    Joined:
    Jul 19, 2020
    Posts:
    30
    Sorry i forgot to reply to this thread, i ended up fixing this issue by animating the object through a script rather than a animation clip.
     
    KalOBrien likes this.