Never use the Unity Animator EVER AGAIN - Full Guide

  Рет қаралды 7,166

Small Hedge Games

Small Hedge Games

Күн бұрын

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...
Support me :) - buymeacoffee.com/smallhedgehq
Website - www.smallhedge.com/
My games - small-hedge.itch.io
Twitter - / smallhedgehq
Facebook - / smallhedgehq
KZfaq 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

Пікірлер: 43
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
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 kzfaq.info/get/bejne/b9qmd9eElty9pYE.html
@WurstOnAir
@WurstOnAir 4 ай бұрын
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 4 ай бұрын
You are absolutely right. I completely overlooked the use of abstract methods and will make the change in the GitHub script.
@Tiff_Dragoon
@Tiff_Dragoon 23 күн бұрын
THANK YOU SO MUCH THIS IS TRULY AMAZING, Like back then I have to find freaking multiple animations online just for it to be slightly different, now this is so much better on so many levels!
@kfirsadeh6090
@kfirsadeh6090 4 ай бұрын
That's awesome man! Will Definitely use it in my game
@Asilthar
@Asilthar 4 ай бұрын
never seen your vods before. 1:52 in i subbed. seems like high quality stuff
@TheAtticus82
@TheAtticus82 2 ай бұрын
Great stuff, man! Just earned a new sub.
@slavabugz2612
@slavabugz2612 3 ай бұрын
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.
@ItzVic
@ItzVic 4 ай бұрын
this is awesome, and I even thought this was a channel with thousands of subs. Keep it up man
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
Thank you!
@user-nk8bi4zi8q
@user-nk8bi4zi8q 4 ай бұрын
I’m making souls like base systems for my masters project after Easter. You’re a lifesaver for this. Thank you!
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
Glad I could help! 😁
@a6gitti
@a6gitti 3 ай бұрын
Super dope video! Huge thanx. Animatior can go autodelete itself, in a loop, no exit time.
@70aon
@70aon 4 ай бұрын
You are the real hero that the world needs. You just singe handedly solved a problem as big as the world hunger!
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
Solving Unity’s problems one burger at a time!
@mohamedhamed3572
@mohamedhamed3572 4 ай бұрын
Amazing!
@snorQz
@snorQz 4 ай бұрын
Amazing ❤❤❤ thx
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
You are welcome 😁
@angelgabrielcaviedesjoya9368
@angelgabrielcaviedesjoya9368 2 ай бұрын
Hey!, how can I implement this with photon pun, since it works precesely with the animator parameters
@khawlatouj8980
@khawlatouj8980 2 ай бұрын
great thank you
@GeniusPancake
@GeniusPancake 3 ай бұрын
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 3 ай бұрын
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. kzfaq.info/get/bejne/b9qmd9eElty9pYE.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.
@WarscarblackbeltX
@WarscarblackbeltX 3 ай бұрын
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 3 ай бұрын
nvm! I played ahead and saw that NONE was added under the Animations enum. My B
@fred1541
@fred1541 3 ай бұрын
Yes, I always face animation hell, which looks like a spider web. Thanks
@sladnam7480
@sladnam7480 4 ай бұрын
Can you explain what "locking the layer" actually does. What changes in the actual Animator that says this is "locked"
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
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
@121Gamerscom 4 ай бұрын
player controller isnt there to test it have you a link ? great video and concept
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
thanks! For the player controller, Brakeys has an excellent tutorial for it kzfaq.info/get/bejne/lbeRndWSx9-4epc.html&pp=ygUgYnJha3lldHMgZmlyc3QgcGVyc29uIGNvbnRyb2xsZXI%3D
@121Gamerscom
@121Gamerscom 3 ай бұрын
@@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
@Jubez81
@Jubez81 9 күн бұрын
Could not get this working hit up hedge no reply :( Stripped my game of it.
@SmallHedgeHQ
@SmallHedgeHQ 9 күн бұрын
Sucks to hear. If you have a specific question, I can help you out with it :)
@daxmiller2670
@daxmiller2670 Ай бұрын
does this method only works for 3d ?
@SmallHedgeHQ
@SmallHedgeHQ 29 күн бұрын
For 2d and 3d! I actually showcase how to use these techniques in 2d in the next video of the series 😁kzfaq.info/get/bejne/b9qmd9eElty9pYE.html
@damonfedorick
@damonfedorick 3 ай бұрын
you can already play animations through code without all these wrappers. i dont understand what the point of this is.
@SmallHedgeHQ
@SmallHedgeHQ 3 ай бұрын
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 3 ай бұрын
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.
@HobokerDev
@HobokerDev 3 ай бұрын
Just use nested state machines like a normal person
@ReneSteenNielsen
@ReneSteenNielsen 4 ай бұрын
The opposite of locked animations is unlocked animations! Don't try to play tricks on me!
@SmallHedgeHQ
@SmallHedgeHQ 4 ай бұрын
xD
@arookas
@arookas 3 ай бұрын
holy crap that humming on the lamp is so annoying
@F_U
@F_U 3 ай бұрын
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 3 ай бұрын
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.
PLEASE use a Unity SOUND MANAGER! - Full Tutorial
15:58
Small Hedge Games
Рет қаралды 6 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 699 М.
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 11 МЛН
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 14 МЛН
Bootstrap Toasts | Bootstrap 5 Tutorial 37
9:21
ChidresTechTutorials
Рет қаралды 8
7 DEVS Make a GAME without COMMUNICATING! (centipede edition)
17:16
Blackthornprod
Рет қаралды 1 МЛН
I Turned My Most Famous SCRATCH Game Into a UNITY Game...
12:13
Play an Animation Clip Without an Animator Controller State | Playables API | Unity Tutorial
25:15
A truly 2D game isn't what you think it is...
13:23
NivMiz
Рет қаралды 32 М.
HACKING UNITY GAMES (FOR NOOBS)
16:11
cazz
Рет қаралды 75 М.
How To Fail At Game Feel
3:48
Artindi
Рет қаралды 66 М.
This Problem Changes Your Perspective On Game Dev
25:51
Jonas Tyroller
Рет қаралды 376 М.
We Spent Over 1 Year Updating Our First Game
14:50
CodyCantEatThis
Рет қаралды 1,2 МЛН
РАТТЕ, почему ты меня ПРЕДАЛ?
5:04
• Gerand •
Рет қаралды 570 М.
ГРАНД-ФИНАЛ! NaVi vs G2 - Esports World Cup 2024 - ЛУЧШИЕ МОМЕНТЫ CS2
50:22