Quantcast
Channel: General - Epic Developer Community Forums
Viewing all articles
Browse latest Browse all 10232

Unified Object Creation

$
0
0

Could there perhaps be a way to unify the creation of objects, so that there is NO LONGER CreateDefaultSubobject AND NewObject? Just ONE object creation function called "CreateObject or some such thing.

CreateObject<UObject>(TObjectPtr<UObject> ObjectOwner, Name = NAME_None)

I figure the way to implement this is to set a class variable boolean bInConstructor with default set to TRUE. Then, create an internal function AFTER the instructor is called, but BEFORE the next major event (such as BeginPlay, etc) is invoked that sets this variable to false.

Then, when you invoke CreateObject, it can create the object ANYtime in code, as it checks for execution location at runtime. If still in the constructor, call the equivalent of CreateDefaultSubobject and all the under the hood stuff tied to that. If not in constructor anymore, then call the NewObject() equivalent.

What do you think?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 10232

Trending Articles