Actor blueprint class can't store references to instances of the same same class

Hello,

I’m trying to define a sequence of Actors by having a variable in my blueprint that points to the next Actor of the same class. I can pick the objects in the level editor just fine, but as soon as I hit Play, the references are lost and set to None.

The work around is to change the variable type to either Actor or another class that is parent to the class that contains the variable.

Hi Pedro,

Could you provide some screenshots showing your blueprint setup?

I tried to reproduce the problem on a blank project. It worked, so I investigated further and I found that the cause of the problem is having a cast anywhere in my blueprint. The variables that point to other instances of the same class are wiped out as soon as the BP is recompiled.

Here’s a minimum example to reproduce the bug:

(MyActor is an empty Actor-derived BP). Place a few FooBar instances on your level and assign values to “Next” and recompile FooBar to see all the references get erased.

Hi Pedro,

This is expected, your workaround is the way to go. The reason the Next variable doesn’t hold a value after compiling is because it’s trying to hold a value of an instanced mesh and instanced meshes are reloaded when play begins or the the blueprint is recompiled.

TJ