其他分享
首页 > 其他分享> > 计时器

计时器

作者:互联网

.h:
FTimerHandle CountdownTimerHandle;
//如果委托事件有参数
void ShiningObject(AStaticMeshActor* Object);

.cpp:
//事件委托
FTimerDelegate UpdateTextureDele = FTimerDelegate::CreateUObject(this, &AWelathActor::UpdateTexture);
//如果事件有参数
FTimerDelegate UpdateTextureDele = FTimerDelegate::CreateUObject(this, &ABIMVRPawn::ShiningObject, Object);
//每0.5秒执行一次事件委托
GetWorld()->GetTimerManager().SetTimer(CountdownTimerHandle, UpdateTextureDele, 0.5f, true);
//停止运行定时器
GetWorldTimerManager().ClearTimer(CountdownTimerHandle);

 

标签:FTimerDelegate,CreateUObject,CountdownTimerHandle,Object,0.5,UpdateTextureDele,
来源: https://www.cnblogs.com/mcomco/p/16588053.html