I’m writing a custom BTTaskNode, here is my code:
EBTNodeResult::Type UBTTask_FireFromOpen::ExecuteTask(UBehaviorTreeComponent & OwnerComp, uint8 * NodeMemory)
{
AMyAIController* MyController = Cast<AMyAIController>(OwnerComp.GetAIOwner());
FBTFireFromOpenTaskMemory* MyMemory = reinterpret_cast<FBTFireFromOpenTaskMemory*>(NodeMemory);
MyMemory->TargetCache = MyController->FindATarget();
FTimerHandle TimerHandle;
//MyController->GetWorldTimerManager().SetTimer(TimerHandle, this, &UBTTask_FireFromOpen::EndFire, 2.0f, false);
FTimerDelegate TimerDel; /**<------ a "this declaration has no storage class type or type specifier" message comes out on hover, and the code compiles with this error */
TimerDel.BindUFunction(this, FName("EndFire"),&OwnerComp, NodeMemory);
/****OwnerComp. ------> fails to list members here,
and a "this declaration has no storage class type or type specifier" message comes out on hover.*/
return EBTNodeResult::InProgress;
}
the problem is if I use OwnerComp BEFORE the FTimerDelegate TimerDel line, when I type “.” the intellisense will list the member of it correctly. so I think the FTimerDelegate declaration is some kind of failure point.
This happens somewhere else, also caused by some structs declaration by Marcos like DECLARE_DYNAMIC_DELEGATE.
Since it’s almost impossible to work with something complicated like UBehaviorTreeComponent if the list member function doesn’t work, how should I fix this?