# LearningAgentsInteractor::SetActionVector , size check uses wrong getter

**URL:** <https://forums.unrealengine.com/t/learningagentsinteractor-setactionvector-size-check-uses-wrong-getter/2719428>\
**Category:** C++\
**Tags:** bug, Reinforcement-Learning, unreal-engine, Learning-Agents, bug-report\
**Created:** [May 1, 2026, 4:40pm UTC](https://forums.unrealengine.com/t/learningagentsinteractor-setactionvector-size-check-uses-wrong-getter/2719428 "2026-05-01T16:40:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdyTheQueen2020](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdyTheQueen2020](https://forums.unrealengine.com/u/AdyTheQueen2020)\
**Post date:** [May 1, 2026, 4:40pm UTC](https://forums.unrealengine.com/t/learningagentsinteractor-setactionvector-size-check-uses-wrong-getter/2719428/1 "2026-05-01T16:40:26Z")

</div>

Hi,

Spotted what looks like a copy-paste bug in Epic’s `LearningAgentsInteractor.cpp` inside `SetActionVector`:

[https://github.com/EpicGames/UnrealEngine/blob/13b6acfd6224d13e37e5c75e94415544116ca945/Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Private/LearningAgentsInteractor.cpp#L673](https://github.com/EpicGames/UnrealEngine/blob/13b6acfd6224d13e37e5c75e94415544116ca945/Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Private/LearningAgentsInteractor.cpp#L673)

```auto
if (ActionVector.Num() != GetObservationVectorSize())

```

`{`

` UE_LOG(LogLearning, Error, TEXT("%s: Action Vector size incompatible. Got %i, expected %i."),`

` *GetName(), ActionVector.Num(), GetActionVectorSize());`

` return;`

`}`

The condition compares `ActionVector.Num()` against `GetObservationVectorSize()`, but the error message logs `GetActionVectorSize()`, which is what the comparison should be using. Looks like it was copy-pasted from `SetObservationVector` (a few methods above) and the condition was missed during the rename.

Practical impact:

- If `ObservationVectorSize == ActionVectorSize` by coincidence, the check passes anyway → nothing visible breaks.

- If the sizes differ (the common case once observations and actions are non-trivial), the function either:

The second case is the dangerous one silent buffer over/under-read on the `ActionVectors[AgentId]` row. No crash in most builds, just garbage actions getting fed to the policy.

The fix is a one-line change:

```auto
if (ActionVector.Num() != GetActionVectorSize())

```

Easy to repro: register an interactor where observation and action sizes differ, then call `SetActionVector` with a properly-sized action vector it’ll get rejected.

Worth filing upstream to Epic, and patching locally in the meantime if you’re hitting the asymmetric-size path.

Cheers

---

<div class="post-metadata">

**Author:** ![Deathcalibur](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/deathcalibur/32/1037610_2.png) [@Deathcalibur](https://forums.unrealengine.com/u/Deathcalibur)\
**Post date:** [May 1, 2026, 5:36pm UTC](https://forums.unrealengine.com/t/learningagentsinteractor-setactionvector-size-check-uses-wrong-getter/2719428/2 "2026-05-01T17:36:43Z")

</div>

Thanks! This will be fixed in UE 5.8
