What are the limitations of Construct Object From Class?

Hello,

I try to instantiate an object from a given class using the function Construct Object From Class. I do that with a BP Actor class I wrote but I get the following message when I compile the main BP:

Error Wrong class to spawn
‘/Game/WkSamples/Recherches/BPHandle/SimpleHandle.SimpleHandle_C’
in Construct Object from Class

I tried with several other classes but I always get this error.
It looks like this function is not documented.
What are the limitations? What do I do wrong?

Thank you

I have the same issue and I’ve managed to replicate it in a new project.
It seems Epic just tossed in a new node without testing it properly.

This node is actually something I’ve waited forever to have and am so happy that it finally exists!

It allows you to spawn objects. That’s pretty much all it does. If you want to spawn an actor (anything that has a location in the level) you will have to use “Spawn Actor From Class”.

This node is exclusively for classes that are not actors. That derive from the core class “UObject” (or just “Object” if you only look at it in BP). It’s the lowest level of Unreals inheritance hierarchy and allows you to have data and functionality stored without having any representation in your level.

Cheers

Thank you very much :wink:

Is there any way to add construction script for this new object? By default it hasn’t ConstructionScript tab and, if ConstructionScript function created manually, it seems doesn’t work. Also how to add arguments to ConstructionScript?

You should probably create something like a construction function in this object and then call it right after it was created.

No matter what I do, it says, “Wrong class to spawn in.” What kind of class do I need?

EDIT: Nevermind. The class has to be directly inherited from object. I missed that part.

I kept trying to construct an blueprint inheriting from Object, and kept getting that error. Your comment made me realize I can create a base blueprint inheriting from Object, and have subclasses from that. Works great when you pass in the new base class type into the node. Thanks :slight_smile: