Never use the Unity Animator EVER AGAIN - Full Guide

Ойындар

Tutorial of how to manage animations entirely through script in the Unity game engine!
Tired of struggling with the Unity Animator? In this tutorial, I'll show you how to create smooth and efficient animations entirely through scripting, eliminating the need for the Unity Animator once and for all! Say goodbye to clunky animations and hello to smooth, customizable movements in your Unity projects.
** Light Flicker Ultimate ** assetstore.unity.com/packages...
Code used in the video: github.com/SmallHedge/Animato...
Asset Showcased:
LIGHT FLICKER: assetstore.unity.com/packages...
ENVIRONMENT: assetstore.unity.com/packages...
PLAYER: assetstore.unity.com/packages...
SOUND FX: assetstore.unity.com/packages...
FOOTSTEPS: assetstore.unity.com/packages...
POST PROCESSING: assetstore.unity.com/packages...
FULLSCREEN: assetstore.unity.com/packages...
🔴 Don't miss the next upload! / @smallhedgehq
KZread avatar created by OliGalArt, go check her out! ko-fi.com/oligalart/commissions
00:00 what we've done so far
00:50 the new system
01:21 how does it work?
02:19 animation types?
03:39 scene setup
04:57 Light Flicker Ultimate
05:10 animator layers
05:55 starting the journey
06:24 Chapter 1: Animator Brain
06:54 AnimatorBrain ENUM
08:20 AnimatorBrain Variables
11:19 AnimatorBrain Initialize
13:16 AnimatorBrain Methods
13:45 AnimatorBrain Play()
16:59 Chapter 2: Creating a Unit
17:59 default animations
21:02 idle animations
22:57 death animation
24:09 reload animation
25:22 OnExit Script
28:29 cancel animations
31:27 shooting animation
33:01 jumping animations

Пікірлер: 38

  • @SmallHedgeHQ
    @SmallHedgeHQАй бұрын

    Hello everyone, hope this workflow is working well for you 😁. Following your amazing feedback on the topic, I put together a plugin for the Unity animator was does all the tricky logic behind the scenes. It only takes 10 seconds of setup and works straight out of the box. Might help y'all out a bit kzread.info/dash/bejne/a6iqptaMYdm_pbA.html

  • @WurstOnAir
    @WurstOnAir2 ай бұрын

    Making the animationBrain abstract and having the default animation method abstract would force the child class to have the defaultAnimation method + having the Action variable would be unneccessary and the initialize parameter would not be neccessary.

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    You are absolutely right. I completely overlooked the use of abstract methods and will make the change in the GitHub script.

  • @Asilthar
    @Asilthar2 ай бұрын

    never seen your vods before. 1:52 in i subbed. seems like high quality stuff

  • @kfirsadeh6090
    @kfirsadeh60902 ай бұрын

    That's awesome man! Will Definitely use it in my game

  • @TheAtticus82
    @TheAtticus8219 күн бұрын

    Great stuff, man! Just earned a new sub.

  • @slavabugz2612
    @slavabugz26122 ай бұрын

    Yeah... fk knows how i found this video, but I will watch it tomorrow, also subbed and bell is turned on. I hope to find more advanved tutorials like this. Thanks king.

  • @user-nk8bi4zi8q
    @user-nk8bi4zi8q2 ай бұрын

    I’m making souls like base systems for my masters project after Easter. You’re a lifesaver for this. Thank you!

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    Glad I could help! 😁

  • @ItzVic
    @ItzVic2 ай бұрын

    this is awesome, and I even thought this was a channel with thousands of subs. Keep it up man

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    Thank you!

  • @fred1541
    @fred1541Ай бұрын

    Yes, I always face animation hell, which looks like a spider web. Thanks

  • @a6gitti
    @a6gitti2 ай бұрын

    Super dope video! Huge thanx. Animatior can go autodelete itself, in a loop, no exit time.

  • @mohamedhamed3572
    @mohamedhamed35722 ай бұрын

    Amazing!

  • @angelgabrielcaviedesjoya9368
    @angelgabrielcaviedesjoya936827 күн бұрын

    Hey!, how can I implement this with photon pun, since it works precesely with the animator parameters

  • @70aon
    @70aon2 ай бұрын

    You are the real hero that the world needs. You just singe handedly solved a problem as big as the world hunger!

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    Solving Unity’s problems one burger at a time!

  • @snorQz
    @snorQz2 ай бұрын

    Amazing ❤❤❤ thx

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    You are welcome 😁

  • @GeniusPancake
    @GeniusPancakeАй бұрын

    Hello, your tutorial is amazing. I did something similar but doing some improvements on it to dynamically add animations when they are played frist. So if you play "run forward" and it doesn't exist in the animations to add it and override the animation component. In my case, since my characters logic is all bound to Observable Properties, instead of having methods inside "PlayerMove", my "CharacterAnimationController" listens to the state changes "(like, state.IsGrounded.AddObserver(b => Play(b ? Animations.IDLE : Animations.JUMP, 1));" and it adapts itself to what it should do next. It makes it so I do not have to have the behaviours on falling, jumping, etc. but it looks at the y velocity and when it is -1 it just transitions itself to falling. Also, besides that, I am trying to figure out PlayableAPI to add certain animations to be played by one shot and then clear the animation but it is a little bit more difficult than what I thought. I just wanted to thank you, it gave me a couple of ideas on how to do my version of the system! Really, thank you!

  • @SmallHedgeHQ

    @SmallHedgeHQ

    Ай бұрын

    Yo thanks! These are really great ideas. Adding listeners would really automate it, without the need of behaviours. If you would like, I put together a plugin called AnimatorCoder in a later video about a week ago. kzread.info/dash/bejne/a6iqptaMYdm_pbA.html It has very little setup, it takes the ANIMATIONS enum and coverts its values into hashes so it basically skips a step. It also adds animator parameter logic and a few other things. I believe it might be the most optimised you can get with this technique.

  • @khawlatouj8980
    @khawlatouj898023 күн бұрын

    great thank you

  • @WarscarblackbeltX
    @WarscarblackbeltXАй бұрын

    At 14:49, I'm getting error CS0117 on line 54 for Animations.NONE, saying "'Animations' does not have a definition for 'NONE'. I'm using Unity 2022.3.8. Is there something I'm missing?

  • @WarscarblackbeltX

    @WarscarblackbeltX

    Ай бұрын

    nvm! I played ahead and saw that NONE was added under the Animations enum. My B

  • @sladnam7480
    @sladnam74802 ай бұрын

    Can you explain what "locking the layer" actually does. What changes in the actual Animator that says this is "locked"

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    The ability to lock a layer is not a native Unity feature. It is simply a bool[] in the animator brain script. When you set it to true (lock the layer), it changes what happens when you call AnimatorBrain.Play(). Now calling AnimatorBrain.Play() does nothing if the layer is locked. When the layer is locked, the AnimatorBrain won’t allow any new animations to play. This is required for animations that need to play all the way through and cannot be interrupted, such as a reload, hit, or death animation. When you come to play these animations, you set the layer to be locked, so no other animation can play. Then there is the option to bypass the lock. These are animations that should play regardless if the layer is locked, such as a death animation. Now if the player is reloading and gets hit, if the animation is set to bypass the lock in AnimatorBrain.Play(), it will play regardless if the layer is already locked. So nothing changes in the Unity Animator itself. It is simply additional logic in the AnimatorBrain script to keep track if it should call Animator.Crossfade() on the requested animation through AnimatorBrain.Play(). Does that kind of make sense?

  • @121Gamerscom
    @121Gamerscom2 ай бұрын

    player controller isnt there to test it have you a link ? great video and concept

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    thanks! For the player controller, Brakeys has an excellent tutorial for it kzread.info/dash/bejne/kYWVzNSakty6esY.html&pp=ygUgYnJha3lldHMgZmlyc3QgcGVyc29uIGNvbnRyb2xsZXI%3D

  • @121Gamerscom

    @121Gamerscom

    Ай бұрын

    @@SmallHedgeHQ The site has closed. After many years of delivering game dev apparel we have decided to shut down Line of Code. It has been an absolute pleasure and we owe a big thanks to everyone who has bought and used our products. We wish all of you the best of luck in the future! Kind regards, The Brackeys Team

  • @HobokerDev
    @HobokerDevАй бұрын

    Just use nested state machines like a normal person

  • @damonfedorick
    @damonfedorickАй бұрын

    you can already play animations through code without all these wrappers. i dont understand what the point of this is.

  • @SmallHedgeHQ

    @SmallHedgeHQ

    Ай бұрын

    1. Hold the CurrentAnimation: So you don't use Animator.Crossfade() on an already playing animation 2. Ability to lock/unlock layers: Some animations need to play all the way through without interuption 3. Play consequent animations: When an animation finishes, choose what animation to play next 4. Select animations through enums: Passing through an enum to play an animation is quick and easy In a nutshell, it adds a bunch additional checks to Animator.Crossfade() to ensure the requested animation is allowed to play.

  • @anti4320

    @anti4320

    Ай бұрын

    This is all possible within the animator. Crossfading, Logic, Sequencing, Layering is all possible within the animation. If your animator state machine tree looks like the example images you showed, then you‘re not using it correctly. Animation state should never be managed by manually coding behavior. Animations should be derived from the state of the target object and not the other way around.

  • @ReneSteenNielsen
    @ReneSteenNielsen2 ай бұрын

    The opposite of locked animations is unlocked animations! Don't try to play tricks on me!

  • @SmallHedgeHQ

    @SmallHedgeHQ

    2 ай бұрын

    xD

  • @arookas
    @arookasАй бұрын

    holy crap that humming on the lamp is so annoying

  • @F_U
    @F_UАй бұрын

    I never understood the problem with animator, I have a game with A LOT of animations and transitions between them. If you think about the animator like a behaviour tree, you can put all the 10 idle animations inside a "idle" sub-tree with its own logic and maybe even more sub-trees inside the sub-tree and all the 25 movement animations inside a "movement" sub-tree with a blend-tree or two. So you only have an idle node with its parameters to go for movement node in the main tree, and inside each you can have it similary clean. It all becomes incredibly well organised and easy to read... I really think the problem is people don't know how animator works, and they just drop all animations there and start linking them in the same "node"... 8:56 I mean, that animator looks more confusing than mine with more than 50 animations...

  • @SmallHedgeHQ

    @SmallHedgeHQ

    Ай бұрын

    Yeah you can really optimise the Unity animator tab if you know how. I suppose it’s down to preference. Whether you prefer the animator tab or scripting.

Келесі