and after that they would be so that the other blows are made and that when doing the 3. it is restarted to the first one again, but I do not know how to write it in the script or if I have something to change in the animator, I would like to know how they would do it others.
this is my script and as I have it in the unity the animator:
Hello.
Never post code as a image, use the code sampler button (or Crtl+K)
And regarding your question, you just need to store each animation in a array
Animation[] AnimationsList
Then use Random.Range to select one animation of the array.
Animation [Random.Range(0,AnimationsList.Length)]
Bye!
@tormentoarmagedoom I don’t know where that code sample button is … and the CRTL + K doesn’t work for me and what about the random.range where would you put it? I have been doing tests and I skipped errors no matter where I put it …
Hi, first of all: holy shit that is an incredible Skybox. If you have made this Skybox and / or models yourself, please add me on Discord: Drissy#2509. Or if you just want to talk too of course
For the solution. What I’d do is keep a variable wherever you keep the Animator. As you want three states, you could simply do the following:
private int _animationIndex = 0;
// do other code
Animator.SetInteger("index", _animationIndex++);
Afterwards, adapt your Blend Tree to include the parameter “index” (or rename it to something more specific).
Then you add this check to transition to one of the three respective animations.
Hope this helps.