Baser object management in Blueprint

As of 4.9, we now have the Construct Object from Class node. However, as it is now, this node is incredibly difficult to use in Blueprint, especially if the object to be spawned was created in Blueprint. I suggest improving the usability of baser objects in Blueprint. Below are my extended thoughts.

First, when creating an object through any other means, we never have to specify an owner. If an object’s reference is never saved, it should be scoped to the function in which it lives. Otherwise, the object lives as long as it is referenced. In any other case, rather than specifying an owner, we simply save a reference variable when we want to keep the object around. In the current implementation, I’m not even entirely sure how to maintain objects only during the life of a function.

We have no way to call a constructor for classes derived from UObject that are created in Blueprint. We can create and call a custom Init function, but that’s pretty clunky.

We have no way to specify static/shared/class variables and functions. We can add an instance to a custom GameInstance, but then systems would be coupled to that game instance.

Ideally, I’d like to be able to create a Message object in Blueprint that has a category and a static/shared list of categories and their subscribers. On its construction, it would send itself to each actor subscribed to the message’s category.

Yes, C++ can do these things. But, the same can be said for everything.

You can’t call constructors (or rether you shouldn’t) of UObjects in C++. In UE4 constructors are used to create default class object, master copy of class and when you create new object engine stamps copy of CBO in to memory, create new object, because it’s copying it constructor is never triggered. Thats why constructors in UE4 are only used to set defaults as it is called when CBO is created (thats why if you do something wrong in constructor, engine crash or throw you a error on start of the engine). Or else you mean something that will clear everything to defaults?

Construction script on other hand is triggered with OnConstruction event if i’m not mistaken,

Probably that’s not what you mean, because I’m a total C++ noob, but instead of Init function you can still init variables by checking “Expose on Spawn” - they’ll show up in Construct node just like in Spawn Actor node.

I was referring to doing things other than setting variables, such as a message sending itself to subscribers upon creation.

I was curious about this too, I don’t want to use an actor for a certain class in blueprints but I could really use a means to have it trigger events/functions upon it’s construction. Perhaps going into c++ and creating a UObject inherited class that somehow knows when it is constructed? I’d love to hear thoughts on this or if I should just suck up the bloat and use actor.