Hello, when I call the method GetOwner in the BeginPlay method I get a null pointer. This is only the code of the BeginPlay method. I have no idea why it is null. Can you give some hint?
void ASTrackerBot::BeginPlay() { Super::BeginPlay(); AActor* MyOwner = GetOwner(); if (MyOwner == nullptr) { UE_LOG(LogTemp, Log, TEXT("Id null")); }
}
And you calling it from … ? And the owner is supposed to be … ?
I’m calling it from the TrackerBot class. The owner is the owner of this actor.
Ok.
The owner is the owner of this actor.
So, if it returns null, then … it has no owner.
TrackerBot doesn’t have an owner since it is not a component, it is not attached to anything. It is an actor in the world.