Spawning an actor with "in editor only" child actors creates unwanted conditions

anonymous_user_c94444d8
Mon, 05 Apr 2021 06:46:23 +0000
World Creation

I have actors that have dynamically generated features. In order for the editor to see anything more than a scene object placeholder, I needed to add representative geometry. For ease of development, I am using an “is editor only” child actor to perform that utility. This use performs flawlessly when the actor is added through the editor. All is good there.

However, during gameplay, when spawning that same actor into the world, all of these “is editor only” child actors are generated. Because they are child actors, their collision data is present. As my dynamic generation continues, these child actors show up as partially functioning duplicates. e.g.: I’ll have one door generated on a building I created that originated from the editor view, but I’ll have two doors generated on a building I created that originated from a gameplay spawn.

The current fix is for me to immediately sweep for all immediate child actors of the newly spawned actor and destroy them before I kick off the rest of my code. Destroying child actors can be problematic. After extensive testing, it looks like I can get away with this - but, I would rather have the spawn actor function be smart enough to not spawn in child actors that are set to “is editor only” in the first place.

I feel this is a bug, but I also know that I am using the UE4 in a unique way. If you find yourself using the “is editor only” flag (under the cooking category) on a child actor, then beware that spawning that actor in the game will include that child actor. Its collisions will apply regardless of visibility. It will respond to interactions as an in-the-game actor.

Hopefully, this information saves you some time. Let me know if there is a way to fix this spawning issue.

1 post - 1 participant