I should have initialized the CharacterOwner in BeginPlay()
, because initialized in:
-
PostLoad()
CharacterOwner->IsTemplate()
returns true: template -
BeginPlay()
CharacterOwner->IsTemplate()
returns false: instanced
void UInventoryComponent::BeginPlay()
{
Super::BeginPlay();
CharacterOwner = Cast<ATheThirdPersonGameCharacter>(GetOwner());
UE_LOG(LogTemp, Warning, TEXT("In %s, IsTemplate() = %s"),
*FString(__FUNCTION__),
CharacterOwner->IsTemplate() ? TEXT("true") : TEXT("false"));
}