Cannot cast to UObject inherited class

I made two C++ classes inherited from UObject. When using the Construct to object blueprint box, I can see these classes, so I am able to create an object from these classes.

However, I am not able to cast an Object to these specific classes. Is this a bug? Or am I missing something?
Thanks !

1 Like

Did you make sure the ‘Context Sensitive’ checkbox is turned off (in your right-click menu in the blueprint graph, when you are trying to add a Cast node)? Start with the dumb question first :slight_smile:

You may want to try making an interface for your custom class to implement, and create a custom “Cast” type event/function for it that outputs an object of the correct type. Then you could message your custom object’s instance, calling that function, and storing it’s output to a local variable. Just thinking out loud here. Good luck!


Thanks, but in fact I found out why my UObject classes were not shown on “Cast To …” blueprint box.

In fact, I was not designed them as UClass(Blueprintable). My mistake.
However, in the meantime, I think a class not specified as Blueprintable should not be present in the “Construct Object” blueprint box, since you cannot rely on the object at all then.

Hope this will help some folks around

Just to make it clear for others who will find this question.

You need to put UCLASS(Blueprintable) before the definition.

For example:

class REVIVEANDPROSPER_API UJobData : public UObject {