On load game, remove actors placed from editor

I have tree actors placed in world from editor. I have option to chop them down, but on new game, they respawn, obviously.
I want to make them disappear on load game.

I tried, saving actor in an actor array, that I store in playerBP and on savegame save.
It works, for 4-7tress. If i chop down more, the array values become empty. Not really sure why it forgets entries so

Also tried setting up tags for actor and On destroyed, saved the actors name in a string array.
And looped to find same names, but when i destroyed too many actors, i got infinite loop error.

Hi Whatevermate.

I would avoid using “GetDisplayName” and use “GetObjectName” instead because instances generated at runtime might have different names. Unreal can also add extensions to names of actors in the world. If you have a tree object called “SM_Tree03” may become "SM_Tree03_355"at runtime.

To solve your problem, I would create a class with an exposed variable which allows you to disable trees.

  1. Right click in your content browser and create a StaticMeshActor (or any actor type you need).

  2. Call BP_MeshBase or a name which identifies that is a base class.

  3. Open the MeshBase and create a variable called “bDestroyActorOnLoad” and add a branch check to destroy the actor on begin play…
    On the variable “bDestroyActorOnLoad” make sure you check the following properties: “InstanceEditable” and “ExposeOnSpawn”

  1. Go back to your content browser, right click and create blueprint class. Open up all classes and select your MeshBase

  1. Open the blueprint and add your Tree mesh. For this example, I called my actor BP_Char and used the starter content chair mesh.

  2. Place instances of your child class in the world (you can just drag them from the content browser).

  3. Look at the details panel, you will see that boolean we added earlier. Check it for items you want to be removed on begin play.

  1. Hit play for results!

I also included an example of hiding a mesh rather than destroying it, in case you need it later.

Good luck!