C++ Interface Cast returns NULL when implemented with Editor

Hi! I had the same problem, I created an interface on C++ and added in the editor to a Widget Blueprint, but the cast return a null.

IResultsInterface* sr =  Cast<IResultsInterface>(object);
if (sr)  sr->SetSumaryData(data);  //fail

The solution was to use the static version of the function:

if (object->GetClass()->ImplementsInterface(IResultsInterface::StaticClass()))
{
	IResultsInterface::Execute_SetSumaryData(b, data);
}

Engine was 5.2.

1 Like