I have a few functions and properties that are the same for one of my AActor and a UActorComponent and i’m trying to derive them from the same class but i’m having troubles with it.
I get the following compiler error:
2> C:/Users/render/Documents/Unreal Projects/dpi-unreal-colosseum/Plugins/VRInteractions/Source/VRInteractions/Public/LookEvents.h(15) : Implements: Class Watchable is not an interface; Can only inherit from non-UObjects or UInterface derived interfaces
But if i implement it as a interface i wouldn’t be able to specifie properties because it gives the following error:
'Member variable declaration' is not allowed here
Would this be possible or would i be better of creating a kind of helper / function library with the logic that they share? I would still need to create exact the same properties for both the classes though.
This is my current base class:
UCLASS(abstract)
class UWatchable : public UObject
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Trigger", AdvancedDisplay)
AActor* Trigger;
This my AActor:
UCLASS(Blueprintable)
class AWatchableActor : public AActor, public UWatchable
{
GENERATED_UCLASS_BODY()
virtual void Tick(float DeltaTime) override;
};
And finaly my AActorComponent
UCLASS(editinlinenew, meta = (BlueprintSpawnableComponent), ClassGroup = Utility)
class ULookEvents : public UActorComponent, public UWatchable
{
GENERATED_UCLASS_BODY()
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
};