UnityHFSM icon indicating copy to clipboard operation
UnityHFSM copied to clipboard

Add IActionable.HasAction() method

Open MasterDisaster64 opened this issue 9 months ago • 0 comments

A method that checks if a state has the given action defined, or if the current state in a state machine has it defined. This can be used to easily create "default behaviors" that can be overridden by defining the action.

Basic example:

if (sm.HasAction(TestAction.Attack))
    sm.OnAction(TestAction.Attack);
else
    print(Time.time + ": Not attacking :(");

This is meant to be an alternative to my other PR like this. You can use the one you think would be most performant in most situations.

MasterDisaster64 avatar May 06 '25 21:05 MasterDisaster64