Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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

    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.