# UE 5.3 StateTree: Hardcoded max active states set to 8

**URL:** <https://forums.unrealengine.com/t/ue-5-3-statetree-hardcoded-max-active-states-set-to-8/1618635>\
**Category:** Programming & Scripting\
**Tags:** error, Behavior-Tree, Code-Plugins, unreal-engine, state-machines, Engine-Source-Code, bug-report, Scripting, Plugins, CPP\
**Created:** [January 16, 2024, 7:34am UTC](https://forums.unrealengine.com/t/ue-5-3-statetree-hardcoded-max-active-states-set-to-8/1618635 "2024-01-16T07:34:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chonker5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chonker5](https://forums.unrealengine.com/u/Chonker5)\
**Post date:** [January 16, 2024, 7:34am UTC](https://forums.unrealengine.com/t/ue-5-3-statetree-hardcoded-max-active-states-set-to-8/1618635/1 "2024-01-16T07:34:29Z")

</div>

Inside FStateTreeActiveStates there is a hardcoded limit for StateTree Depth

`static constexpr uint8 MaxStates = 8;	// Max number of active states`

Which means you cannot do something like this:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/e/bee1cd0d91008ad88848023cb3b33f73d55b95c7.png)

You’ll get an error:  
`FStateTreeExecutionContext::SelectStateInternal: Reached max execution depth when trying to select state Child h1 from '(State Invalid):Unset'.`

Epic plz fix

---

<div class="post-metadata">

**Author:** ![mugenmelon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mugenmelon/32/1035828_2.png) [@mugenmelon](https://forums.unrealengine.com/u/mugenmelon)\
**Post date:** [March 3, 2024, 4:31pm UTC](https://forums.unrealengine.com/t/ue-5-3-statetree-hardcoded-max-active-states-set-to-8/1618635/2 "2024-03-03T16:31:12Z")

</div>

Bumped into the same issue on my side.  
It is especially annoying since linked states will count towards that limit. So effectively you can only nest 4 linked states.

I don’t see how the limit can continue to be hardcoded considering Epic is working on [external subtree assets](https://portal.productboard.com/epicgames/1-unreal-engine-public-roadmap/c/1470-external-state-tree-sub-tree).

As for AI behavior it is questionable if you really need that much nesting, especially if you want to avoid monolithic trees.  
However, state trees are also meant to be _general purpose state machines_ and it is very easy to hit 4 nested linked states with those.

---

<div class="post-metadata">

**Author:** ![TheDogtoy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheDogtoy](https://forums.unrealengine.com/u/TheDogtoy)\
**Post date:** [February 21, 2025, 2:59pm UTC](https://forums.unrealengine.com/t/ue-5-3-statetree-hardcoded-max-active-states-set-to-8/1618635/3 "2025-02-21T14:59:30Z")

</div>

Yeah, this is terrible. They wanted to use static sized arrays but this is bad way to optimize.
