(Note: had to break this into 4 parts due to character limits)
The BPs in question are components which are derived from a custom C++ class.
The idea was that any actor or component in the project would have a native, abstract base class, and a blueprint class which inherits from that. That way, prototyping and experimentation could be done in the blueprint class, and then moved down into native code once the design stabilizes / it’s needed for performance / there’s just something which is too complex to do in blueprint.
The problem arises when you’re trying to construct blueprint components in a C++ actor’s constructor. While it’s not that hard to do in a lot of places, and works fine, the CDOs being generated super-early during editor startup means that I haven’t been able to find a place to set a UCLASS variable in order to provide the blueprint class which the actors need to create their components early enough for them to be used in the constructor.
Putting the variable on the native base class, and setting it in the blueprint class’ default properties doesn’t work, because it appears that the defaults from the CDO are copied over to the instance in the constructor, but the first thing the BP’s constructor appears to do is run the base class’ constructor, so components are created before default properties are set.
In this case, I’m trying to do it using a game data singleton. Since this lives in engine, I (incorrectly) thought that it would be available, because why would you ever start creating instances of game objects before the engine is initialized? (Right?)
(Continued below…)