Great thank you! When creating new sub-state machine, you can just drag and drop your existing animations onto the sub-state. Little plus icon will pop up next to your cursor and when you let go, all dragged animation states will be moved into the sub-state :)
Great video! I was wondering: Could you also use a blend tree instead of a sub state machine? By just using whole numbers you wouln't actually blend between the animations, so you'd still get the four random animations but without having to set up a transition for every one of them (which is by far the most annoying part of animation setup in unity IMO)
Great tutorial, i just had a few question about this. With it showing as IEnumerator, can you have this set up under a OnTriggerEnter as a Coroutine? Then on the while(true) can you have that set as a bool variable? I wanted to set up a boss that would start attacking once the player enters a trigger and wanted some random attacks set up to make it look better.
Hello thank you for a nice tutorial! I am new in it and added this to my object, so everytime I press object, different animations playing. But I have an issue, The animator is playing only the first animation from the entry and not adding any other random animations, because I am calling the animation from different scene. Is there a way to make this code work for any scene? Hope I made myself clear, thanks anyone who can help
Lol that intro. I've actually been googling this for the past 24 hours and kept getting results on the Random.Range function but clearly something was missing. Setting an integer for each animation. Makes sense. Also learnt about sub state machines. This'll help keep the messy animator a little tidier. Thanks a lot.
hell yeah, hopefully i can set this up correctly, I intend to do a coinflip anim with a true random heads / tails, and possibly a 20 sided die down the line if i feel like torturing myself
Nice lesson, but something doesn't work. It only plays the first animation each time. I copied the script even though it was hard to read letter by letter, but apparently it doesn't generate random numbers, only 0.
Is there a way to play an animation without having it inside an animator or loading it into the animator, say you have 200 items and you can hold them differently. I would rather not want to load all of them onto an animator if possible. Thanks!
thats exactly my problem its so frustrating and it seems there is no way todo that :( i have a ton of different idle animations and i simply dont want them all inside the animator and instead just create a array with all anims and select them randomly. it sucks that it seems to be impossible
Very interesting and in editor everything works perfectly following the step by step instructions, but when I go to compile the build it stops with the following error (also displayed in the console): Error building Player: BlendTree "Blend Tree" in state "standing1" in Controller "Test" uses parameter "Attack" which is not float type. As per instructions, the attack parameter must be set on trigger but Unity reports it as an error and does not make me compile the build ... any ideas on how to solve? Thanks Mauro
Great video, thanks! In this example you've set it to be completely random across the range of 4 animations. What if you wanted to introduce probabilities, so for example there's an 85% chance the first attack animation will play, and a 5% chance that the others will. How would you impingement that?
Great tutorial as usual! No bells and whistles, just pure content.
Perfect. Great tutorial. Straight to the point. Worked first time. Easy to follow.
Great thank you! When creating new sub-state machine, you can just drag and drop your existing animations onto the sub-state. Little plus icon will pop up next to your cursor and when you let go, all dragged animation states will be moved into the sub-state :)
Short and effective. Just the way I like tutorial. Thanks mate!
Worked perfectly, and explained perfectly! Thanks so much!
Well done! I'm guilty of the first example, rewriting my controllers to use this going forward. You rock!
i have learned so many things from you, thank you!
Very helpful video! Thanks!🤘🤘
This is exactly what I needed for my stadium crowd actors. Thanks!
Great vid. To the point and easy to follow. Many thanks.
Thanks sooooooo much!
You're the goat man, thanks so much
Thanks!
perfect mate, thank you
This was very helpful, thanks.
thanx bro for this video You deserve 1000 likes 🤞
Good stuff ill be using this in the future
Love the thumbnail 🤣
Gotta get on that clickbait 😂
Awesome dude...... you da Man!
Great video! I was wondering: Could you also use a blend tree instead of a sub state machine? By just using whole numbers you wouln't actually blend between the animations, so you'd still get the four random animations but without having to set up a transition for every one of them (which is by far the most annoying part of animation setup in unity IMO)
🎉
Great tutorial, i just had a few question about this. With it showing as IEnumerator, can you have this set up under a OnTriggerEnter as a Coroutine? Then on the while(true) can you have that set as a bool variable? I wanted to set up a boss that would start attacking once the player enters a trigger and wanted some random attacks set up to make it look better.
Thanks Man.
Thank you very much! It was very useful.
My own method worked too but yours is more easier.
Really good. Reminds of Grand theft Auto the
Perfect!
yes!!! This is exactly what i needed!!!! Thx!
that intro was the funniest thing ivbe seen in a unity tutorial thank you a lot man
Woohoo ! Thank you sir !
Thank you Sir
Great tutorial cheers 🙂
Spoon fed, You are amazing :)
thanks hoss
Hello thank you for a nice tutorial! I am new in it and added this to my object, so everytime I press object, different animations playing. But I have an issue, The animator is playing only the first animation from the entry and not adding any other random animations, because I am calling the animation from different scene. Is there a way to make this code work for any scene? Hope I made myself clear, thanks anyone who can help
A rly great tutorial tnx it rly help me
Lol that intro. I've actually been googling this for the past 24 hours and kept getting results on the Random.Range function but clearly something was missing. Setting an integer for each animation. Makes sense. Also learnt about sub state machines. This'll help keep the messy animator a little tidier. Thanks a lot.
You could do the same without sub-state I guess. Just having attack index is enough.
🔩Anyone know how to access trigger parameters using Bolt / Visual Scripting?
hell yeah, hopefully i can set this up correctly, I intend to do a coinflip anim with a true random heads / tails, and possibly a 20 sided die down the line if i feel like torturing myself
Nice lesson, but something doesn't work. It only plays the first animation each time. I copied the script even though it was hard to read letter by letter, but apparently it doesn't generate random numbers, only 0.
It works! Now I'm gonna throw on some Bee Gee's and strut down my street like a boss!!!
This maybe a very dumb question but how do you sync say your characters sword swing with a given particle effect?
I have a tutorial on my channel about Animation Events. That's exactly what you need
@@comp3interactive Big Thank there man!!
Is there a way to play an animation without having it inside an animator or loading it into the animator, say you have 200 items and you can hold them differently. I would rather not want to load all of them onto an animator if possible. Thanks!
thats exactly my problem its so frustrating and it seems there is no way todo that :( i have a ton of different idle animations and i simply dont want them all inside the animator and instead just create a array with all anims and select them randomly. it sucks that it seems to be impossible
I think the right way to do it in this case is using Animator Overrides, that's the way I'm doing it for my game and it has worked flawlessly so far.
Thanks! You save my diploma project
no way this is the easiest way
Very interesting and in editor everything works perfectly following the step by step instructions, but when I go to compile the build it stops with the following error (also displayed in the console):
Error building Player: BlendTree "Blend Tree" in state "standing1" in Controller "Test" uses parameter "Attack" which is not float type.
As per instructions, the attack parameter must be set on trigger but Unity reports it as an error and does not make me compile the build ... any ideas on how to solve? Thanks Mauro
Can you do a tutorial für simpel animation. For example idle to wark or run
I was tried that since 2 weeks. But i wont get it
Use blend tree Very easy and loads of videos on youtube m8
Great video, thanks!
In this example you've set it to be completely random across the range of 4 animations. What if you wanted to introduce probabilities, so for example there's an 85% chance the first attack animation will play, and a 5% chance that the others will. How would you impingement that?
Just tried this tutorial which looks amazing but when it goes back to idle it gets stuck there? any ideas what im doing wrong?
Great video but I'm havinf trouble swithcing from the idle animation to any others. It just stops. If anyone has any solutions I'd appreciate the help
Pööfekt
You're my fucking hero! The unity boards were of no help.
same solution was in my mind but i didnt have confidence to implement it and ended up searching on youtube
Thank you so much!!