Simple State Component

The Simple State component provides a simple state machine. Each state is represented by a name and an array of zero or more entities. The entities are activated upon entering the state and deactivated upon exiting it. A simple state component may be in NullState, which means no state is active.


O3DE Core (LmbrCentral) Gem

Simple State properties

Simple State component properties

Initial stateThe active state when the Simple State component is first activated.<None> or state Name<None>
Reset on activateIf enabled, Simple State component returns to the Initial state when activated, and not the state held before deactivating.BooleanEnabled
StatesAn array of states.
States - NameDefines the name of the state.StringNew State
States - EntitiesAn array of entities that are associated with a state.EntityIdNone


Request NameDescriptionParameterReturnScriptable
GetCurrentStateReturns the Name of the current state.NoneState: StringYes
GetNumStatesReturns the total number of states.NoneCount: IntegerYes
SetStateSets the component to a specific state by Name.State: StringNoneYes
SetStateByIndexSets the component to a specific state by its index in the States array.State Index: IntegerNoneYes
SetToFirstStateSets the component to State[0], the first state in the States array.NoneNoneYes
SetToLastStateSets the component to the last state in the States array.NoneNoneYes
SetToNextStateSets the component to the next state in the States array.NoneNoneYes
SetToPreviousStateSets the component to the previous state in the States array.NoneNoneYes


Notification NameDescriptionParameterReturnScriptable
OnStateChangedNotifies listeners that the state has changed.NoneOld State: String, New State: StringYes

For more information, see Working with the Event Bus (EBus) system .

Copyright © 2022 Open 3D Engine Contributors

Documentation Distributed under CC BY 4.0.
For our trademark, privacy and antitrust policies, code of conduct, and terms of use, please click the applicable link below or see

The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.