How to make an interface in C++ like a BP interface?

Hello guys,

I have code in c++ like:

UINTERFACE(Blueprintable)
class UThumbnailActorInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class IThumbnailActorInterface
{
	GENERATED_IINTERFACE_BODY()

public:

	UFUNCTION(BlueprintNativeEvent, Category="KingNet|Thumbnail interface")
	void OnGetFocus(const FVector& ImpactPosition, const FVector& ImpactNormal);

But in blueprint I can’t find the “OnGetFocus (Message)” as same as if I declared a Blueprint Interface with a function called “OnGetFocus” inside. I even don’t have a node “cast to ThumbnailActorInterface”.

I’ve no idea what I missed. Or it’s just impossible.

Thanks

Xiu

I don’t know if it is the reason, but for blueprint function you must derive from UBlueprintFunctionLibrary and the functions must be static.

An example :

UCLASS()
class KSGM_API UKObjectManager : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()
public:
	/**
	 * @brief Helper function to get a pickup object using its UID.
	 *
	 * @param UID The unique object id.
	 * @return    The corresponding AKPickupObject pointer. 
	 * 		      If not found, NULL is returned.
	 */
	UFUNCTION(BlueprintCallable, Category = "Helper|Object")
	static AKPickupObject* GetPickupObject(FString UID);

Thanks for reply, but it’s not about BP function.
If you make a BP interface which have declared a function “example function”, you can drag a node “example function (message)” from any target object.
And my problem is that an interface I made in c++ didn’t act like a BP interface.

Sorry for bad English.

hi guys,

Problem solved, I found this thread: BlueprintNativeEvent not showing pins in the event node in the graph editor? - Blueprint - Unreal Engine Forums.

Just From:

 UFUNCTION(BlueprintNativeEvent, Category="KingNet|Thumbnail interface")

To:

 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category="KingNet|Thumbnail interface")

Still I think the docs about BlueprintNativeEvent need to be more clear.

Thanks for your time,
Thank domzorg for all the help.

Xiu