How can i use UPROPERTY and UFUNCTION when a class does not inherit from another class?

I have a class that needs variables which i can edit in the blueprinteditor (So it needs UPROPERTY(EditAnywhere) ).
But my class does not inherit from any UE4 class. I just use this class as a base class for 2 other classes (that inherit from it). I can’t use the UPROPERTY and UFUNCTIOn for some reason. Is it possible to do so?

Hey there,

For class members to be reflected in the editor and customizable using UPROPERTY specifiers like “EditAnywhere”, your abstract class has to be a UCLASS() that inherits from a UObject class or any child of it. As the engine generates code that exposes that “EditAnywhere” variable to the editor.

No, refection system only supports UObject based classes, other classes won’t be visible to UE4.

But there work around depending on what you trying to do, structs. Structs in UE4 can only use UPROPERTY, but on C++ side of things structs work same way as class, you can not use UFUNCTION… but you can still make unregistered functions on C++and you can always do nodes for that struct via static functions in some UObject.

The only issue is fact that you can not use struct pointers in blueprints, as most you can use references and when you set struct you just create create copy of data.