So, I have an interface in C++:
UINTERFACE(BlueprintType)
class MYPROJECT_API UHudInterface : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class MYPROJECT_API IHudInterface
{
GENERATED_IINTERFACE_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "HudInterface") bool OpenMenu(EMenus menu);
};
This shows up in the editor just fine. I then have a blueprint that has this interface:
That works just fine as well. However, if I try to go back to C++ and grab the hud from the player controller:
void AMainGameState::Test()
{
APlayerController * playerController = UGameplayStatics::GetPlayerController(this, 0);
IHudInterface * hud = Cast<IHudInterface>(playerController->GetHUD());
}
hud will always end up as null. My question is, is it even possible to create an interface in C++, have a blueprint use it, and then reference the interface back in C++?