Cannot construct objects of type

After upgrading to 4.18 I got new errors in my blueprints on creation objects from C++ class using “Construct Object from Class” node.

224861-cannotconstruct.png

This code worked well with 4.16 and it looks like it’s not working since 4.17.

Project has no compilation errors or warnings in C++ code.

Sources of the class that I’m trying to construct: [CommandHistory.h][2] [CommandHistory.cpp][3]

What I’ve already tried:

  • Remove the node and create it again (nothing changed)
  • Clean the project and rebuild it (nothing changed)
  • Get rid of default constructor in my class in case of some other constructor is used (nothing changed)
  • Upgrade and build project on a different PC in case of broken UE4 installation (nothing changed)
1 Like

That helped! Thanks!

Did you try using BlueprintType in the UCLASS specifier?

4 Likes

Can you elaborate what that means?

1 Like

It means you declare class as follows:

UCLASS(BlueprintType)
class ... : public UObject
{
GENERATED_BODY()
};
3 Likes

Is there a way to do this for a blueprint class?

3 Likes

I already did this and I’m still getting that error:

Error: Cannot construct objects of type ‘/Script/BlahBlah.Function’ in Construct Object from Class

2 Likes

This is also broken for me, no actionable feedback from the compiler

Check what object you inherit from, if it’s Actor, you need to use

Spawn Actor From Class
1 Like