Download

C++ Interface to Blueprints

I’m trying to figure out how to get this to work…

I can get it this far.
3e0c73bf69.png

I’m trying to figure out how I can make it cause an event so that my designer with No C++ skills can implement functionality to objects.
The goal is to allow the player to press an input and a contextually appropriate action can take place on any actors that are deemed to need such functionality.

Do I need to implement the interface into my Character class first?

Here’s my Interface code:



.H

#pragma once

#include "InteractInterface.generated.h"
/**
 * 
 */
UINTERFACE(Blueprintable)
class UInteractInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class IInteractInterface
{	GENERATED_IINTERFACE_BODY()

public:

	UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interact")
	void OnInteract() const;
};

.CPP

#include "InteractInterface.h"

UInteractInterface::UInteractInterface(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}