StateBehaviour<TState> Class

Summary

Base class for UnityEngine.MonoBehaviour states to be used in a Animancer.FSM.StateMachine`1.
Assembly
Animancer.dll
Namespace
Animancer.FSM
Interfaces
Base Types
  • MonoBehaviour
Derived Types
graph BT Type-->Base0["MonoBehaviour"] Type-.->Interface0["IState<TState>"] Type["StateBehaviour<TState>"] class Type type-node Derived0["CreatureState"]-->Type click Derived0 "/animancer/api/Animancer.Examples.StateMachines.Brains/CreatureState" Derived1["CreatureState"]-->Type click Derived1 "/animancer/api/Animancer.Examples.StateMachines.Creatures/CreatureState" Derived2["CreatureState"]-->Type click Derived2 "/animancer/api/Animancer.Examples.AnimatorControllers.GameKit/CreatureState" Derived3["CreatureState"]-->Type click Derived3 "/animancer/api/Animancer.Examples.StateMachines.Platformer/CreatureState" Derived4["CreatureState"]-->Type click Derived4 "/animancer/api/Animancer.Examples.StateMachines.InterruptManagement/CreatureState"

Syntax

[HelpURL(StateExtensions.APIDocumentationURL + nameof(StateBehaviour<TState>) + "_1")]
public abstract class StateBehaviour<TState> : MonoBehaviour, IState<TState> 
    where TState : StateBehaviour<TState>

Attributes

Type Description
HelpURLAttribute

Type Parameters

Name Description
TState

Methods

Name Value Summary
CanEnterState(TState) bool
Determines whether the Animancer.FSM.StateMachine`1 can enter this state. Always returns true unless overridden.
CanExitState(TState) bool
Determines whether the Animancer.FSM.StateMachine`1 can exit this state. Always returns true unless overridden.
OnEnterState() void
Asserts that this component is not already enabled, then enables it.
OnExitState() void
Asserts that this component is not already disabled, then disables it.
OnValidate() void
[Editor-Only] Called by the Unity Editor in Edit Mode whenever an instance of this script is loaded or a value is changed in the Inspector.

States start disabled and only the current state gets enabled at runtime.