Maybe you forgot to inherit from UResettable?
Try
Pausable.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "Resettable.h"
#include "Pausable.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UPausable : public UResettable
{
GENERATED_BODY()
};
/**
*
*/
class INTER_INHERITANCE_API IPausable : public IResettable
{
GENERATED_BODY()
public:
virtual void setPause(){}
};
Resetable.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "Resettable.generated.h"
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UResettable : public UInterface
{
GENERATED_BODY()
};
/**
*
*/
class INTER_INHERITANCE_API IResettable
{
GENERATED_BODY()
public:
virtual void setReset() {}
};
boxEntity.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Pausable.h"
#include "BoxEntity.generated.h"
UCLASS(Blueprintable)
class INTER_INHERITANCE_API ABoxEntity : public AActor, public IPausable
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABoxEntity();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void setPause() override;
void setReset() override;
UFUNCTION(BlueprintCallable)
void hitTest();
class USphereComponent* collision;
FVector Start;
FVector End;
UPROPERTY(EditAnywhere,BlueprintReadWrite)
float radius;
};
BoxEntity.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "BoxEntity.h"
#include "DrawDebugHelpers.h"
#include "Components/SphereComponent.h"
// Sets default values
ABoxEntity::ABoxEntity()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
collision = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere collision"));
collision->SetupAttachment(GetRootComponent());
collision->SetSphereRadius(radius);
collision->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldDynamic, ECollisionResponse::ECR_Block);
hitTest();
}
// Called when the game starts or when spawned
void ABoxEntity::BeginPlay()
{
Super::BeginPlay();
hitTest();
}
// Called every frame
void ABoxEntity::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
hitTest();
}
void ABoxEntity::setPause()
{
}
void ABoxEntity::setReset()
{
}
void ABoxEntity::hitTest()
{
Start = GetActorLocation();
End = GetActorLocation() + (GetActorLocation() + GetActorForwardVector() * 1400);
FHitResult hit;
FCollisionQueryParams qp;
qp.bDebugQuery = true;
qp.bTraceComplex = true;
FCollisionResponseParams colResponse;
DrawDebugSphere(GetWorld(), End, 20, 12, FColor::Orange, false, 22222222, 0, 2);
GetWorld()->LineTraceSingleByChannel(hit, Start, End, ECollisionChannel::ECC_WorldDynamic, qp, colResponse);
if (IsValid(hit.GetActor()))
{
DrawDebugSphere(GetWorld(), hit.Location, 12, 12, FColor::Red, false, 22222222, 0, 2);
if (hit.GetActor()->GetClass()->ImplementsInterface(UPausable::StaticClass()))
{
if (IPausable* pausable_actor = Cast<IPausable>(hit.GetActor()))
{
GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Cyan, hit.GetActor()->GetName() + " is IPausable");
pausable_actor->setPause();
}
}
if (hit.GetActor()->GetClass()->ImplementsInterface(UResettable::StaticClass()))
{
if (IResettable* resettable_actor = Cast<IResettable>(hit.GetActor()))
{
GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Cyan, hit.GetActor()->GetName() + " is IReset");
resettable_actor->setReset();
}
}
}
}
Here you can see both are found no problem