Search Unity

Official Learn Live: Animation

Discussion in 'Road to the Metaverse' started by Unity-Gehan, Jun 9, 2022.

  1. Unity-Gehan

    Unity-Gehan

    Administrator

    Joined:
    Feb 28, 2022
    Posts:
    27
    Animation
    Recorded May 18, 2022

    The world around you is in constant motion. The same is true for digital worlds. A static environment tends to appear unfinished, or cold and unfeeling; animation is all about creating the illusion of life. In this session, you will learn how to create animations in the Unity editor and how to configure animations imported from an external program. You’ll apply these concepts to add animation to objects and characters in your scenes, and even control when the animation gets played.

    Watch now | View Slides
     
    Last edited by a moderator: Jun 23, 2022
  2. gavinprior

    gavinprior

    Joined:
    Jul 27, 2020
    Posts:
    43
    Hi All.

    I am late to the show but am getting through the sections pretty quickly so a bonus for me (no waiting for the next monthly tutorial haha!). I've dabbled with Unity for a while but with no direction as such so haven't really progressed. The 'road to the metaverses' has been great and i've already learned a lot more than I would just muddling through.
    Here's a link to my simple animation:



    There are three different animations: The car; the base the car is on; three coloured spot lights above. I use some simple visual scripting to set the animation(s) going (on a mouse click) and then to reset to the start.

    I had fun putting it together. Hope you like it too :)
     
    BenUnity3d and jeromeatunity like this.
  3. mattgduran94

    mattgduran94

    Joined:
    Jan 28, 2021
    Posts:
    3
    Hello,
    I’ve been watching the on-demand RTTM, specifically the visual scripting and animation, and i have hit a sticking point that I was curious if you could give some guidance to.
    My goal is to have a parent game object with child objects all animated. What I was looking to do was have each animation to play on a button press, sequentially.
    For example:
    press button> animation plays for child game object 1

    Press same button> if animation for child game object 1 has already played, then play animation for child game object 2, and so on…

    Thanks in advance!
     
  4. jeromeatunity

    jeromeatunity

    Joined:
    Jul 1, 2018
    Posts:
    63
    Are you animating with an Animator & Animation clips, or are you looking at using a Tweening library?
     
  5. mattgduran94

    mattgduran94

    Joined:
    Jan 28, 2021
    Posts:
    3
    I’ve been using the Animator and Animation clips.
     
  6. jeromeatunity

    jeromeatunity

    Joined:
    Jul 1, 2018
    Posts:
    63
    Ok. Here's one way to do it...
    • Set up an animator controller with an int parameter (I called mine Animation Index in the image below) to track and increment the position (clicks) in the animations
    • Create an idle state as the default state
    • Add the animations used in the sequence

    • Setup transitions between the states. I used the greater than 0 as a condition for the first one, then greater than 1, etc.


    • Finally, I linked the Any State node to the Idle state with the condition that Animation Index equals 0. Meaning that from anywhere, if I set the index to 0 the animator will reset to the Idle state.

      Note the unchecked Can Transition To Itself. This is to avoid Idle looping back to Any State when Animation Index is 0. That way, the transition happens only once.
    Here is a visual script example for incrementing the index on click. It uses two variables, one to assign the maximum number of animations, and another to track the current index.



    Again, there are many ways to this, but I hope this helps.
     
    gavinprior likes this.
  7. mattgduran94

    mattgduran94

    Joined:
    Jan 28, 2021
    Posts:
    3
    Thank you! I will give this a try!