Spawn Actor from Construction Script (loophole)

Thanks Nick for explanations.

In our project we use an persistent TArray<AActor*> ManagedActors; in the C++ base for our Blueprint.
When the CS reruns, we determine how many more actors we need and only create them if the amount of valid AActor* in the array is less than that.

Since the array is defined in c++ it is not reset to its default (empty) state upon every rerun of the CS. (hint for feature request :wink: Wanna be able to mark BP defined variables to “survive” rerunning the CS - i.e keep their value untouched. Probably via adding them to the ComponentInstanceData for that Actor/BP under the hood).

If we reduce the amount of Actors we need, we shrink the array by properly de-allocating the content (detach from any parent it may have, remove reference from array and tell the world to destroy that actor) - in that order.

The reason we spawn actors in the CS is that we want to be able to interact with them in the editor viewports during design/edit time in order to set properties of a certain selection set at once etc.
Sadly the ActorComponent so far did not give us selection specific details panel to work with… - will see what the new BP’able Components will bring in that regard. :slight_smile:

Thanks again and keep up the good work