Class must inherit UObject or a UObject-derived class

I’m getting an error:

error : Class must inherit UObject or a UObject-derived class

I used a Generic class from Unreal engine editor… My structure is like this:

#pragma once

#include “GameFramework/Character.h”
#include “ActorAnimations.h”

#include “BasePlayer.generated.h”


/**
 *
 */
UCLASS()
class ****_API ABasePlayer : public ACharacter, public ActorAnimations
{
	GENERATED_UCLASS_BODY()

	/**
		Side view camera
		https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Camera/UCameraComponent/index.html
		*/
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
		TSubobjectPtr<UCameraComponent> SideViewCameraComponent;

	/**
		Camera boom positioning the camera beside the character
		https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/USpringArmComponent/index.html
		*/
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera)
		TSubobjectPtr<class USpringArmComponent> CameraBoom;
private:
	void InitializeAllDependantObjects(const FPostConstructInitializeProperties& PCIP);
	void SetUpCameraComponent();
	void SetUpCameraBoonComponent();
};

You can see here that my Character inherits its animations from a class I am creating (to allow separate programmers to work on that file at once)

Here is that ActorAnimations class I generated:


#pragma once

/**
 * 
 */
UCLASS()
class ****_API ActorAnimations
{
	GENERATED_UCLASS_BODY()

	// The animation to play while running around
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Animations)
	class UPaperFlipbook* RunningAnimation;

	// The animation to play while idle (standing still)
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Animations)
	class UPaperFlipbook* IdleAnimation;
public:
	ActorAnimations();
	~ActorAnimations();
};

what am I missing?

It looks like the problem is in the ActorAnimations class as it doesn’t extend from anything. Try extending from UObject and see if that fixes the problem. That is from what I can see currently. I am not familiar with multiple inheritance in UE4 currently so I could be wrong but I am thinking the UCLASS() macro is for UObject or classes extending from UObject.

ActorAnimations : public UObject

@dzeligman:

Where am I going to get the FPostConstructInitializeProperties from:


UObject(const class FPostConstructInitializeProperties& PCIP);

or


UObject( EStaticConstructor, EObjectFlags InFlags );

so:


ActorAnimations : public UObject( errrm )

@warlord57:

Yes, removing the UClass stopped the error being throw, i’ll see if the properties make their way through to the Unreal editor and write the result here… Cheers buddoss.

------EDIT--------
My properties are not coming through into the editor… I have a Blueprint based off of my BaseCharacter.h file but the animations haven’t come through… Hmm.