Should you call Super?

Should Super::ExecuteTask be called?

and when every you call Super::… should we also check the ret value just in case??

EBTNodeResult::Type UChooseNextWaypoint::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) { EBTNodeResult::Type ret = Super::ExecuteTask(OwnerComp, NodeMemory);
if (ret == EBTNodeResult::Succeeded)
{
	UE_LOG(LogTemp, Warning, TEXT("Hello from ExecuteTask"));
}

return ret;

}

It’s worth seeing what the parent class does. In this case, Super::ExecuteTask is

EBTNodeResult::Type UBTTaskNode::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
	return EBTNodeResult::Succeeded;
}

So no, no need to call the parents ExecuteTask which is just the most basic possible implementation.

1 Like

Privacy & Terms