How to make weak object pointer to UINTERFACE-derived class?

It is my impression that an array of GC-aware references to C++ implementations of an Unreal Interface class (declared with UINTERFACE, etc) can be made like so:

UPROPERTY()
TArray<TScriptInterface<ISomeUnrealInterface>>

And that an array of GC-Aware weak references to any old UObject can be made like so (notably without any UPROPERTY macro):

TArray<TWeakObjectPtr<USomeUnrealObject>>

But I am left a bit flummoxed as to how one would make an array of GC-aware weak pointers to unreal interfaces. Is it even possible?

For anyone looking for an answer to this old question, check TWeakInterfacePtr<> out. It’s defined in GameplayTaskTypes.h

1 Like

Well, I for one am satisfied to have an answer, even if the project it was for has long ago been laid at peace. I will try to test this and accept the answer if I have the time (Though I may end up forgetting—I’m not even working on anything in Unreal at this exact moment).

One thing to note is TWeakInterfacePtr does not propagate cv qualifiers of the template type. Didn’t have this issue with TWeakObjectPtr. So TWeakInterfacePtr<const IMyInterface> won’t compile. I had to use TWeakInterfacePtr<IMyInterface> and cast away the constness with a const_cast<IMyInterface*> prior to invoking the TWeakInterfacePtr constructor.