Here’s what I want:
- As a starting point, take the “UObjectExample” plugin that comes with the engine
- Make it so that I can create a Blueprint class that inherits from the ‘UMyPluginObject’ defined in this plugin
How can I accomplish this?
Here’s what I want:
How can I accomplish this?
Copy the header (MyPluginObject.h) and put it in the same folder, say MyDerivedPluginObject.h. Then you’ll want something like this:
#include "MyPluginObject.h"
#include "MyDerivedPluginObject.generated.h"
UCLASS(Blueprintable)
class UMyDerivedPluginObject : public UMyPluginObject
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = MyCategory)
int32 MyFunction() { return MyNumber; }
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Numbers)
int32 MyNumber;
};
Note the Blueprintable metadata specifier, that’s what makes it usable as a base class for blueprints.
MyPluginObject.h is only included because the class inherits from it, but you don’t have to of course. (It’s pretty useless). Normally you would inherit from AActor, UActorComponent/USceneComponent or straight from UObject.