I have an interface and a class that attempts to implement it. I know that when you call a function through an interface, you have to use the Execute_ prefix with the method name. However, whenever I try to call a function using the Execute_ prefix, I get a build error:
> class “IExampleInterface” has no memver “Execute_ExampleFunction”
Everything else about the interface works as intended. I just cannot get this to work. Below is my work. Sorry if it is a bit hard to read, it’s pasted directly from my answerhub post, and I don’t have time right now to properly correct it.
> IExampleInterface.h
#pragma once
#include “CoreMinimal.h”
#include “UObject/Interface.h”
#include “IExampleInterface.generated.h”
UINTERFACE(MinimalAPI)
class UExampleInterface : public UInterface
{
GENERATED_BODY()
};
class FPROJECT_API IExampleInterface
{
GENERATED_BODY()
public:
void ExampleFunction(float ExampleParam);
};
>What I’m trying to do
//This works with no error. ExampleClass implements IExampleInterface
IExampleInterface ExampleInterface = Cast<IExampleInterface>(ExampleClass);
if(ExampleInterface){
//This throws the error previously mentioned at the top
//Intellisense can see ExampleFunction,
//however it cannot see Execute_ExampleFunction
ExampleInterface->Execute_ExampleFunction(ExampleClass, 1.0f);
}
Any help is appreciated.