Why can't I add a default functionality for interface functions?

Hello,

in the default .cpp file of a interface is written:

// Add default functionality here for any IPooledObjectInterface functions that are not pure virtual.

But this does not seem to work. I have an interface:



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "PooledObjectInterface.generated.h"

#define DebugPrintGreen(text) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 60.0f, FColor::Green,text)

// This class does not need to be modified.
UINTERFACE(MinimalAPI, Blueprintable)
class UPooledObjectInterface : public UInterface
{
GENERATED_BODY()
};

/**
*
*/
class BRICKGAMEVRCPP_API IPooledObjectInterface
{
GENERATED_BODY()


public:
// called when this actor is taken from a pool. Should handle things like making the actor visible, enabling ticking etc.
UFUNCTION(BlueprintNativeEvent, Category = "Pooled Object Interface")
void OnTakenFromPool();

// called when this actor is released to a pool. Should handle things like making the actor invisible, disabling ticking etc.
UFUNCTION(BlueprintNativeEvent, Category = "Pooled Object Interface")
void OnReleasedToPool();

UFUNCTION(BlueprintNativeEvent, Category = "Pooled Object Interface")
void OnAddedToPool();

// release this actor to the pool. Should be called instead of DestroyActor().
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pooled Object Interface")
void ReleaseToPool();
virtual void ReleaseToPool_Implementation();
};


and in the .cpp file:



// Fill out your copyright notice in the Description page of Project Settings.


#include "PooledObjectInterface.h"
#include "../../Utils/ObjectPool/ObjectPoolFunctionLibrary.h"

// Add default functionality here for any IPooledObjectInterface functions that are not pure virtual.

void IPooledObjectInterface::ReleaseToPool_Implementation()
{
check(false);
}


I implement the interface in a BP, do NOT override ReleaseToPool and call ReleaseToPool on it. It should crash with the assert check(false). But it does nothing. It’s like if the BP doesn’t know the default functionality.
What’s wrong with this?

Thanks,

Thilo

Hello,

I am currently running into the same issue.

So far, I discovered that using an C++ interface with default native implementated function doesn’t work if you setup this interface on a blueprint directly (the default native function is ignored).

However creating a C++ class that implements the interface and then creating the blueprint from it seems to work as expected.

Depending of the combinatorial explosion you have this solution might not be that usefull but this is the only one I found to use the feature.

I was thinking of creating helper class with static function to put there the default behavior but I would prefer not do it if possible

If anyone have a clean solution for this issue, let us know.
Thanks,

Mhaa