StateMachine<TKey, TState>.

TrySetState(TKey) Method

Summary

Attempts to enter the state registered with the specified `key` and returns it if successful.
Assembly
Animancer.dll
Namespace
Animancer.FSM
Containing Type
StateMachine<TKey, TState>

Syntax

public TState TrySetState(TKey key)

Remarks

This method returns true immediately if the specified `key` is already the Animancer.FSM.StateMachine`2.CurrentKey. To allow directly re-entering the same state, use Animancer.FSM.StateMachine`2.TryResetState(`0) instead.

Parameters

Name Type Description
key TKey

Return Value

Type Description
TState