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?
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.
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?
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