Rotate Blueprint inherited from custom C++ class

I want to rotate a blueprint actor every tick towards the player. The blueprint looks like that:

The blueprint’s base class is a custom C++ class which is inherited from another custom class. The interesting thing is: When I create a blueprint inherited from AActor or APawn, everything works fine. I don’t know if that’s relevant but I can rotate my actor by using my C++ class.

Another question would be:
How do I use the FindLookAtRotation function in C++? I couldn’t figure it out.

Can you show us the C++ classes?

Regarding the other question:
Search the whole code base for FindLookAtRotation or use VisualAssistX etc.

You will find this:

FRotator UKismetMathLibrary::FindLookAtRotation(const FVector& Start, const FVector& Target)
{
	return MakeRotFromX(Target - Start);
}

You’re going to hit yourself for this one - you have nothing hooked up to “Parent Tick” in the Blueprint. You need to add an Event Tick and hook it up or nothing in Blueprint is going to run.

A good way to catch things like this is to use breakpoints within Blueprint. You would have seen that your execution nodes are never being reached.

i’ve already tried to use the tick, but when i try to compile it gives me a warnig saying that the function can’t tick. But that is not the problem cause i’ve tried other events like key input for e.g. and it still wasn’t working

Have you tried setting breakpoints in your blueprint to identify if the execution is happening? Your blueprint is very basic - the issue is going to be getting your blueprint to execute.

The blueprint you posted won’t execute because it’s not hooked up. You need to post more information for us to be able to help.

Shootable.h:
UCLASS()
class AShootable : public AActor {
public:
GENERATED_UCLASS_BODY()

	UPROPERTY(Category = Stats, EditAnywhere, BlueprintReadWrite)
		float health;

	virtual void OnHit(int8 dmg);
	
};

Shootable.cpp:
AShootable::AShootable(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{

}

void AShootable::OnHit(int8 dmg) {
	Destroy();
}

Enemy.h:
UCLASS()
class AEnemy : public AShootable {
public:
GENERATED_UCLASS_BODY()

UPROPERTY(Category = Mesh, VisibleDefaultsOnly, BlueprintReadOnly)
	TSubobjectPtr<class UStaticMeshComponent> PlaneMesh;

UPROPERTY(Category = Mesh, VisibleDefaultsOnly, BlueprintReadOnly)
	TSubobjectPtr<class UStaticMeshComponent> LightMesh;

UPROPERTY(Category = Mesh, VisibleDefaultsOnly, BlueprintReadOnly)
	TSubobjectPtr<class USphereComponent> Ranger;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mesh)
	UMaterialInstanceDynamic* MatInst;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gameplay)
	APlaynerPawn* PP;

UPROPERTY(Category = Stats, EditAnywhere, BlueprintReadWrite)
	float maxHealth;

UFUNCTION(BlueprintImplementableEvent, Category = Combat)
	void Update();

virtual void BeginPlay() OVERRIDE;
virtual void Tick(float DeltaSeconds) OVERRIDE;

void OnHit(float dmg);

};

and the Enemy.cpp:

AEnemy::AEnemy(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	struct FConstructorStatics1 {
		ConstructorHelpers::FObjectFinderOptional<UStaticMesh> PlaneMesh;
		FConstructorStatics1() : PlaneMesh(TEXT("/Game/Meshes/Character/EnemyShip_body.EnemyShip_body")) {}
	};
	static FConstructorStatics1 ConstructorStatics1;
	PlaneMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PlaneMesh0"));
	PlaneMesh->SetStaticMesh(ConstructorStatics1.PlaneMesh.Get());
	RootComponent = PlaneMesh;

	struct FConstructorStatics2 {
		ConstructorHelpers::FObjectFinderOptional<UStaticMesh> LightMesh;
		FConstructorStatics2() : LightMesh(TEXT("/Game/Meshes/Character/EnemyShip_lights.EnemyShip_lights")) {}
	};
	static FConstructorStatics2 ConstructorStatics2;
	LightMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("LightMesh0"));
	LightMesh->SetStaticMesh(ConstructorStatics2.LightMesh.Get());
	LightMesh->AttachTo(PlaneMesh);
	//UMaterialInterface* Material = LightMesh->GetMaterial(0);
	//MatInst = LightMesh->CreateDynamicMaterialInstance(0, Material);

	Ranger = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("RangeSphere"));
	Ranger->AttachTo(RootComponent);
	Ranger->SetSphereRadius(1000.f);

	maxHealth = 100.f;
	health = maxHealth;
}

void AEnemy::BeginPlay() {
	MatInst->SetScalarParameterValue(TEXT("intensity"), health / maxHealth);
	PP = Cast<APlaynerPawn>(UGameplayStatics::GetPlayerPawn(this, 0));
}

void AEnemy::Tick(float DeltaSeconds) {
	Super::Tick(DeltaSeconds);
	Update();
}

void AEnemy::OnHit(float dmg) {
	if (health <= dmg) {
		Destroy();
	}
	else {
		health -= dmg;
		MatInst->SetScalarParameterValue(TEXT("intensity"), health/maxHealth);
	}
}

Yes I did. The problem is the SetActorRelativeRotation node. (99% sure about that)