The Problem
I need to set properties of a spawned actor before component signature callbacks are triggered - on both the spawned actor and existing world actors.
The Setup
I have a Minion class that extends Character. It has a SphereComponent with OnBegin/OnEnd overlap delegates to keep track of other enemy minions when they’re in range of the minion. There’s also a property that identifies the owner of the minion that is used to determine which minions are enemies of the owner. The component and signatures are created in Minion’s constructor. The identifier is set manually from whichever class is spawning the Minion.
Example of the problem
I’ll spawn a Minion from another class (GetWorld->SpawnActor), the constructor will execute, but it will also immediately trigger Overlapping events on existing nearby actors, as well as the spawned actor, before I can set the Minion’s owner identifier.
Possible Resolutions
I could simply not rely on the dynamic properties I need to set (collect all minions and evaluate which to attack later), or create subclasses for each minion of each team, but I think both solutions are inefficient in the long run. I’m hoping there’s some construction hook I’m overlooking, or I’d like to suggest the broadcasting of initial component signatures be moved to execute just prior to BeginPlay(), which will allow the class that spawned the actor time to initialize and set other properties of the actor.