Getting To Know Animations


This latest update for v2.03, I got to learn some new things about Unity. This was a great learning experience for me, though I wonder if everyone knows about this already and I'm late to the party...

  1. Animation Layers: I had an issue when adding in the movement animation for the T-Rex. I wanted the animation for walking to be independent from the arm throwing newspapers. I was thinking maybe I needed to create two animation controllers, but that felt wrong. I did some searching on the internet and found my answer. That Layers tab in the Animator window does something!
    So I created a Body layer and an Arm layer, setup the states/transitions and then... only the arm moved... Dug deeper into it and realized I needed to set the weight in both layers to 1. That did it and now we have a funny walking T-Rex that can also throw newspapers.
  2. Sprite Swap: The issue here was that the velociraptor and the triceratops are prefab variants from a general Dinosaur prefab. When I made the second variant, I had to create new sprites, new animation controller and new animations. I wondered if there was a way to skip making a new controller and animations and after some digging, there was and it's called Sprite Swap. It uses a Sprite Library and Sprite Resolver. They act as an extra abstraction between the sprites and sprite renderer. So in the animation, it doesn't need to know exactly what the sprite for that frame is, but it'll know the label defined in the library. I had to retool within the prefabs with a new structure and now it's good. Though I'll only really make maybe two more dinosaur types, it'll be easier to do and this was a good learning experience.
  3. Random Sprites For Particle System: This was actually for v2.02, but I forgot to mention it. For the effect when a newspaper informs a dinosaur, I wanted it to shoot out random letters. I had to do some research and found that it was possible for the particle system to choose a random sprite for each particle. It required the Texture Sheet Animation section. I won't get into the many specific details, but it worked out for me... kinda... I realized afterwards that the particles are so small that you can barely make out the letters. I ended up leaving it to randomize between the letters A, B and C instead of more letters.

Okay, so now that I think I'm done making changes to the Dinosaur prefab, I'll make a new dinosaur type for the next update.

Leave a comment

Log in with itch.io to leave a comment.