TSubclassOf interface variable


I’m currently having issues with assigning interfaces to TSubclassOf variables in the default panel.
If I make a function that looks like this:

UFUNCTION( BlueprintCallable, Category = "Test" )
void CallFunctionWithInterface( TSubclassOf<UInterface> FuncInterface );

Then when I call the function in blueprints, it will show all available interfaces. But if I make a variable that’s declared like this:

TSubclassOf<UInterface> VariableInterface;

Then it will only show blueprint interfaces in the default section of the blueprint, but if you do a set VariableInterface in the blueprint graph, it will show all interfaces.


This still happens in 4.20. Did you find a solution to this?

I don’t know for the latest version. But in version 4.12 you could not store interface as variable like this.
You had to use TScriptInterface<IYourInterface> or to store your object as a UObject and then cast it in IYourInterface

4.23 - still an problem. Anyone find solution to have interface class as variable?

but TScriptInterface is pointer type of variable, not class variable to select which interface to use.
Also TSubclassOf will not show interfaces objects.

Found solution but AllowedClasses won’t work so you will see all objects (including interfaces)
UPROPERTY(Category = Blackboard, EditDefaultsOnly, meta = (AllowAbstract = “1”, AllowedClasses = “UInterface”, ExactClass = false))
UClass* BaseClass;

TSublcass is working as well:
UPROPERTY(Category = Blackboard, EditDefaultsOnly, meta = (AllowAbstract = “1”, AllowedClasses = “UInterface”, ExactClass = false))
TSubclassOf Asd;