【UE4 C++】获取运行时间、设置时间流速、暂停游戏
2021/5/8 12:28:52
本文主要是介绍【UE4 C++】获取运行时间、设置时间流速、暂停游戏,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
基于UGameplayStatics
获取运行时间
/** Returns the frame delta time in seconds, adjusted by time dilation. */ UFUNCTION(BlueprintPure, Category = "Utilities|Time", meta = (WorldContext="WorldContextObject")) static float GetWorldDeltaSeconds(const UObject* WorldContextObject); /** Returns time in seconds since world was brought up for play, adjusted by time dilation and IS stopped when game pauses */ UFUNCTION(BlueprintPure, Category="Utilities|Time", meta=(WorldContext="WorldContextObject")) static float GetTimeSeconds(const UObject* WorldContextObject); /** Returns time in seconds since world was brought up for play, adjusted by time dilation and IS NOT stopped when game pauses */ UFUNCTION(BlueprintPure, Category="Utilities|Time", meta=(WorldContext="WorldContextObject")) static float GetUnpausedTimeSeconds(const UObject* WorldContextObject); /** Returns time in seconds since world was brought up for play, does NOT stop when game pauses, NOT dilated/clamped */ UFUNCTION(BlueprintPure, Category="Utilities|Time", meta=(WorldContext="WorldContextObject")) static float GetRealTimeSeconds(const UObject* WorldContextObject); /** Returns time in seconds since world was brought up for play, IS stopped when game pauses, NOT dilated/clamped. */ UFUNCTION(BlueprintPure, Category="Utilities|Time", meta=(WorldContext="WorldContextObject")) static float GetAudioTimeSeconds(const UObject* WorldContextObject); /** Returns time in seconds since the application was started. Unlike the other time functions this is accurate to the exact time this function is called instead of set once per frame. */ UFUNCTION(BlueprintPure, Category="Utilities|Time", meta=(WorldContext="WorldContextObject")) static void GetAccurateRealTime(const UObject* WorldContextObject, int32& Seconds, float& PartialSeconds);
设置时间流速
-
设置全局时间流速
static float GetGlobalTimeDilation(const UObject* WorldContextObject); static void SetGlobalTimeDilation(const UObject* WorldContextObject, float TimeDilation);
-
设置指定Actor时间流速
AActor* MyActor; MyActor->CustomTimeDilation = 0.5f;
暂停游戏
static bool SetGamePaused(const UObject* WorldContextObject, bool bPaused); static bool IsGamePaused(const UObject* WorldContextObject);
这篇关于【UE4 C++】获取运行时间、设置时间流速、暂停游戏的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-24怎么切换 Git 项目的远程仓库地址?-icode9专业技术文章分享
- 2024-12-24怎么更改 Git 远程仓库的名称?-icode9专业技术文章分享
- 2024-12-24更改 Git 本地分支关联的远程分支是什么命令?-icode9专业技术文章分享
- 2024-12-24uniapp 连接之后会被立马断开是什么原因?-icode9专业技术文章分享
- 2024-12-24cdn 路径可以指定规则映射吗?-icode9专业技术文章分享
- 2024-12-24CAP:Serverless?+AI?让应用开发更简单
- 2024-12-23新能源车企如何通过CRM工具优化客户关系管理,增强客户忠诚度与品牌影响力
- 2024-12-23原创tauri2.1+vite6.0+rust+arco客户端os平台系统|tauri2+rust桌面os管理
- 2024-12-23DevExpress 怎么实现右键菜单(Context Menu)显示中文?-icode9专业技术文章分享
- 2024-12-22怎么通过控制台去看我的页面渲染的内容在哪个文件中呢-icode9专业技术文章分享