Simple Unity Animator HACK

preview_player
Показать описание
This video covers a really simple and great way to apply multiple animations to a character without cluttering up the animator.

We use Unity's Animator Override Controller, to turn one state into unlimited. It's a great method that uses runtime animation swapping to keep the animator clean and maintain the diversity of swapping out multiple animations for a single state.

Comment below if you are familiar with the override controller and have additional tips or if you found this helpful!

Share this with someone who needs it! I hope you enjoy!

Don't forget to like and subscribe!

Thanks for watching!

►Files for Video:
Unfinished Project to Follow Along:
Finished Project:

►Assets used in Video:
CRT Studio - Bows Pack
Sandro T - Flooded Grounds
Nokobot - Modern Guns(Handgun)
GameReadyStudios - Rifle

► Join us on Discord!

► Follow me on Twitch!

► Follow me on Twitter!

► Become a Patron!

► If you have any suggestions or lessons feel free to comment below. Thanks!

► If you enjoyed the video please leave a LIKE and SUBSCRIBE to keep up to date on my latest tutorials and videos.

#Unity #Tutorial#GameDev
Рекомендации по теме
Комментарии
Автор

Amazing stuff as always
699 subs, congratulations

UnderfundedScientist
Автор

Nice. I might have to review this again next game.

nichegames
Автор

That's cool man, I always end up with a rats nest in the Animator so maybe ill give this a go

tauheedgamedev
Автор

Probably would have been just easier to do this in the editor, where it autogenerates most of this for you with just one create command and automatically creates all the fields for the animation clips found, then just grab a reference to that and activate it at runtime

But for a larger scale I think this is pretty clever if you combine it with a double level dictionary like <weapon <animationType, animation>> style solution, then make a short solution to automate the changing of all the animations in the override controller, depending on the weapon, and if there isn't one, default to the general one provided. Something like this

public void OverrideAnimations(WeaponBase weapon)
{
if
foreach (var animationValuePair in
{
if (animationValuePair.Value != null &&
OverrideAnimations(weaponAnimations.defaultAnimations[animationValuePair.Key], animationValuePair.Value);
}
}
While it looks rather messy, you could populate it pretty easily with something like this:

public void weaponType, AnimationType animationType, AnimationClip animationClip)
animationsByWeaponType.Add(weaponType, new Dictionary<AnimationType, AnimationClip> { {animationType, animationClip } });

You could then have complete animation sets pulled from addressable assets and populated/cached in those dictionaries when needed

If I ever get around rewriting the animator hell that is ExplosiveLCC with over 1000! animations all backed in one layer in one controller, this is most likely what I'd use to separate the nested animation mess of 2H sword/ 2H spear /1H sword / unarmed and every other one million variations to a more neatly contained and performant controller

Songfugel
Автор

U need to add the shift to run and a new movement to walk and run because the why u move is wierd tho :( k

BallVsScretch