Search Unity

Best practice using the "Any State" in the animator

Discussion in 'Animation' started by LeFuji, Mar 2, 2021.

  1. LeFuji

    LeFuji

    Joined:
    Oct 2, 2018
    Posts:
    18
    Hello all!

    I'm diving in the animation portion of my game. Basic concept is some sort of Plants vs Zombies setup (With some lanes across the map), and the player will be able to deploy some soldiers on these lanes, and they will, by themselves, advance and shoot through the scene. As you can see, it is not heavily animation wise game.

    I've bough some assets, and they give me awesome animations, everything I might need, actually: The movement forward and backwards, and some turn to left and right for switching lanes.

    Since soldier can equip different weapons, I've set some State Machines, to store animations based on the equipment the soldier have. If he switches equipment, I'll go back to the Base Layer, animate it, and dive into his respective State Machine. (Yes, only one state machine has this switching weapons setup).

    upload_2021-3-1_20-48-9.png

    Inside these state machines I got several animations that are triggered, like being shot, shooting, reloading, interacting with the objective... And now I got a bunch of events triggering all from Any State, and before I tie everything up, I got the vision that this might get messy real quick.

    upload_2021-3-1_20-51-49.png

    Ps.: There are 13 animations below Any State, and this should go up to 39, since I got these for standing, crouching and on prone. And this will repeat itself on different weapons.

    Maybe this is the only way, but is there a better way to organize this? I'm speaking specially performance wise, since I'm the solo developer, I won't need to share this with anyone else, and it might stay confusing, but is best to learn best practices early.

    Thanks!
     
  2. LeFuji

    LeFuji

    Joined:
    Oct 2, 2018
    Posts:
    18
    Just a quick update: This is how my animation looks like, only for when the soldier is carrying a rifle. Handguns, melee and rocket launchers are being handled on a different State Machine:

    upload_2021-3-2_16-31-56.png

    First time really diving into a project with more diverse animation settings, I don't know if this is normal or if this might break the performance of the game.