Cast TScriptInterface to other Interface

Is TScriptInterface still on the list for getting some love? Trying to pass a TScriptInterface pointer as a parameter is disturbing as it always fails with the same error message as the OP (cannot convert from IInterface* to UObject*). Having to manually setup the TScriptInterface to pass an interface pointer around is just not very nice. I pass my interface pointers like so:

void IComponentEventListener::SomeFunction()
{
	// Prevents the cast to UObject* error
	TScriptInterface<IComponentEventListener> TS;
	TS.SetObject(Cast<UObject>(this));
	TS.SetInterface(this);

	SomeClassObj->TalkToMe(TS);

	// What I would really like to see is:
	SomeClassObj->TalkToMe(this);
}

void SomeClass::TalkToMe(TScriptInterface<IComponentEventListener> EvL)
{
}

Anyways, I hope there will be more transparency with interfaces in the near future.

2 Likes