Hi. I’m a bit confused as to how to properly work with the TScriptInterface. I was not able to locate a lot of information on it. But from what I understand I need to check if the object is NULL before I try to run any Execute calls to it.
The main problem I’m having is that Unit.GetObject(), GetObjectRef() and GetInterface() seems to always return nullptr. Or at least the cast to “unit” fails with either of them. How ever when I put a breakpoint in Visual Studio I can see that Unit.ObjectPointer contains the correct actor.
Any ideas?
void UCombatBase::EnterCombat(TScriptInterface<ICombatUnit> Unit)
{
ICombatUnit* unit = Cast<ICombatUnit>(Unit.GetObject());
}
Btw. does there exist a safe way to do something simular to a " blueprint message" in c++, which does not care if its null? It would be nice if I could just call Unit.MyFunction rather than to test if Unit is null for each call.