Hi, I follow what you said here. It work pretty well, appart when I’m testing if it’s valid. It’s always return false !
I’ve tested with a log, and the "TScriptInterface<>->GetObject()->GetName() print me the good think. So my pointer is not false. So I have no idea why the test is always false.
// Called when the game starts
void UActionManager::BeginPlay()
{
Super::BeginPlay();
// ...
if ( GetOwner()->GetClass()->ImplementsInterface( UActionable::StaticClass() ) )
{
OwnerAsActionable = GetOwner();
UE_LOG( LogPacInit, Warning, TEXT( "%s -> %s (Component Owner) implement Actionable Interface" ), *GetName(), *OwnerAsActionable.GetObject()->GetName() );
}
else
{
UE_LOG( LogPacInit, Warning, TEXT( "%s -> %s (Component Owner) don't implement the Actionable Interface" ), *GetName(), *GetOwner()->GetName() );
}
}
/........
void UActionManager::OnGainFocus( APawn * Instigator )
{
if ( !OwnerAsActionable )
{
UE_LOG( LogPacActionSystem, Warning, TEXT( "%s->OnGainFocus : The component owner don't implement Actionable Interface !" ), *GetName());
return;
}
OwnerAsActionable->OnGainFocus( Instigator );
}