0
Answered

Some questions about “state machine”

Fox Kin 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 10

Because the animation event cant used in bolt,

so I use the “state machine” 

make a timer which can do something at 0.5s delay (the animation can finish)



but there is some unit    I cant understand 


Will you give me some example about :How to use

 “on exit state event”

 “stop” and "stopped" 


Its can help me finish the tutoria for 2DPlatform Game by Bolt  

thank you!

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1

"On Exit State" well execute AFTER the transition.  In your example above, if you have the On Exit unit in the Start state, it will activate after 0.5 seconds.


By the way, you can do legacy style animations like this 


+1

You can control Mecanim animations with "IsName", but right now it's not a unit (Pinging Lazlo!).

Im guessing your game is 100% Bolt for tutorial purposes, but it is possible to fix your own unit with script.

public bool IsAnimStateNamed(Animator animator, string stateName)
{
    return animator.GetCurrentAnimatorStateInfo(0).IsName(stateName);
}

Then


EDIT: or just add AnimatorStateInfo to your types, like discussed below :D

As we have access to  Unitys entire code base  couldn't he also  use Units Mecnim and just convert them to units?

+1
Pending Review

Yes, you could add AnimatorStateInfo to your types and use IsName directly in the graph. 

I always forget about that! 😊

thanks for your help!!

I got the AnimatorStateInfo and IsName  

but  I still cant  get the event when the animation is Finishing……

If I dont use the state machine

(To be honest,its too complex for  "delay time to do something " )


so  i think i must wait the next version?  wait the animation event or delay time,maybe better  


You don't need to do that delay every time you make a delay. You can make it directly inside a custom Delay unit and reuse it over and over without ever making one again. Just add an enter, exit, float delay time input output. I've got one myself, works flawlessly. Although I didn't approach it the same way.

Thats a pretty good idea.  There's probably even a clever way to input an animator or related component, then automatically delay based on the current clip length.

Answered

I understand the delay node is a priority; I'll try to move it up the roadmap.