UE4 C++整理

1.计时器

首先要声名一个FTimeHandle,

FTimeHandle   myHandle;  //myHandle相当与给定时器娶了一个名字?用来与其他定时器或是委托进行区分???

定时器的使用方法:

//参数:(FTimerHandle& InOutHandle, UserClass* InObj, typename FTimerDelegate::TUObjectMethodDelegate< UserClass >::FMethodPtr InTimerMethod, float InRate, bool InbLoop = false, float InFirstDelay = -1.f)

GetWorld()->GetTimerManager().SetTimer(参数);

GetWorld()->GetTimerManager().SetTimer(myHandle, this, &URAvataComponent::PlayShow, length, false);  //绑定引用了 &URAvataComponent::PlayShow,(① PlayShow方法在这里为什么没有“()”)

关闭方法:

GWorld->GetTimerManager().ClearTimer(myHandle); //停止并清除定时器

GetWorldTimerManager().ClearTimer(myHandle);  //Aactor?

①:因为SetTimer()的参数只需要传 typename,并且这个这个方法不能带有产数?

原文地址:https://www.cnblogs.com/fuhaiqing/p/13431284.html