Download

Can interfaces be assigned to variables like actor components with BlueprintSpawnableComponent?

Hi, I noticed you can assign to variables in blueprint a newly instantiated component if they have the meta tag BlueprintSpawnableComponent:



    UPROPERTY(Category = "Test", EditAnywhere)
    UShapeComponent* ShapeComponent;


EditShapeComponent.png

You can assign to ShapeComponent every class that inherent from UShapeComponent recursively.

Can the same thing be done with interfaces?
Let’s say I have an interface:



UINTERFACE(BlueprintType, Blueprintable)
class UMyInterface : public UInterface
{
    GENERATED_BODY()
};

class MYGAME_API IMyInterface
{
    GENERATED_BODY()

public:
    virtual void MyMethod() = 0;
};


And a variable to this interface in another class:



    UPROPERTY(Category = "Test", EditAnywhere)
    TScriptInterface<class IMyInterface> MyInterface;


Can I see every class that implements that interface and assign to this variable in blueprint?

EditInterface.png

I few months ago I asked a similar question. It was related to UObject and while BrUnO XaVIeR gave me a good start, Mowgl33 gave something a little bit more like I wanted.
I managed to achieve something similar to what I am asking here using UDataAsset where a class would inherent from UDataAsset and that class would effectively be used as the interface.

I still want to know if this can be achieved with unreal interfaces. Does anyone have a clue?