基于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++】获取运行时间、设置时间流速、暂停游戏的更多相关文章

  1. [WinAPI] API 14 [获取、设置文件属性和时间]

    >_< 为了获取文件属性,用户可以使用GetFileAttributes与GetFileAttributesEx函数. GetFileAttributesEx函数除了返回文件属性外,还返回 ...

  2. Delphi获取与设置系统时间格式,即GetLocaleInfo和SetLocaleInfo

    在Delphi中,特别是在写管理系统软件时,经常要用到 FormatDateTime 以将 TDateTime 格式的日期时间转换成字符串形式的值显示或保存起来,或者用 StrToDateTime将字 ...

  3. redis中获取没有设置ttl过期时间的key

    需求:redis作为一个内存型的数据库,我们需要对过期key保持关注,从info keyspace中可以看出有多少key没有设置过期时间,那么到底是哪些呢? 说明:关于redis ttl 的返回值,请 ...

  4. [转载] C/C++中怎样获取日期和时间

    C/C++中怎样获取日期和时间摘要:  本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时.时间的获取.时间的计算和显示格式等方面进行了阐述.本文还通过大量的 ...

  5. C/C++中怎样获取日期和时间

    C/C++中怎样获取日期和时间摘要: 本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时.时间的获取.时间的计算和显示格式等方面进行了阐述.本文还通过大量的实 ...

  6. JAVA中获取当前系统时间及格式转换

    JAVA中获取当前系统时间   一. 获取当前系统时间和日期并格式化输出: import java.util.Date;import java.text.SimpleDateFormat; publi ...

  7. Java 获取当前系统时间方法比较

    转载: http://blog.csdn.net/zzjjiandan/article/details/8372617 一. 获取当前系统时间和日期并格式化输出: import java.util.D ...

  8. java中获取日期和时间的方法总结

    1.获取当前时间,和某个时间进行比较.此时主要拿long型的时间值. 方法如下:  要使用 java.util.Date .获取当前时间的代码如下 Date date = new Date(); da ...

  9. JAVA中获取当前系统时间

    一. 获取当前系统时间和日期并格式化输出: import java.util.Date;import java.text.SimpleDateFormat; public class NowStrin ...

随机推荐

  1. k8s 存活探针(健康检查)

    重启策略 (RestartPolicy ) Always:当容器终止退出后,总是重启容器,默认策略. OnFailure:当容器异常退出(退出状态码非0)时,才重启容器. Never:当容器终止退出, ...

  2. 【曹工杂谈】说说Maven框架和插件的契约

    说说Maven框架和插件的契约 前言 Maven框架就像现在公司内的各种平台方,规定一些契约,然后想办法拉动业务方,一起在这个平台上去做生态共建.Maven也是这样,其实它就是一个插件执行的框架,Ma ...

  3. IPSec协议框架

    文章目录 1. IPSec简介 1.1 起源 1.2 定义 1.3 受益 2. IPSec原理描述 2.1 IPSec协议框架 2.1.1 安全联盟 2.1.2 安全协议 报文头结构 2.1.3 封装 ...

  4. 经典多级时间轮定时器(C语言版)

    经典多级时间轮定时器(C语言版) 文章目录 经典多级时间轮定时器(C语言版) 1. 序言 2. 多级时间轮实现框架 2.1 多级时间轮对象 2.2 时间轮对象 2.3 定时任务对象 2.4 双向链表 ...

  5. 【第十一篇】- Git Gitee之Spring Cloud直播商城 b2b2c电子商务技术总结

    Git Gitee 大家都知道国内访问 Github 速度比较慢,很影响我们的使用. 如果你希望体验到 Git 飞一般的速度,可以使用国内的 Git 托管服务--Gitee(gitee.com). G ...

  6. HCNP Routing&Switching之IS-IS路由渗透和开销

    前文我们了解了IS-IS邻居建立过程.LSDB同步.拓扑计算和路由的形成:回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15265698.html:今天我们来聊 ...

  7. prometheus从零开始

    本次的想法是做服务监控 并告警  主要线路如下图所示 1.运行prometheus  docker方式 docker run -itd \ -p 9090:9090 \ -v /opt/prometh ...

  8. 【AGC025B】RGB Color

    [AGC025B]RGB Color 题面描述 Link to Atcoder Link to Luogu Takahashi has a tower which is divided into \( ...

  9. HDU1213How Many Tables(基础并查集)

    HDU1213How Many Tables Problem Description Today is Ignatius' birthday. He invites a lot of friends. ...

  10. 全流程指导Visual Studio Code+Markdown Nice+gitee+PicGo管理自己的技术博客文章

    全流程指导Visual Studio Code+Markdown Nice+gitee+PicGo管理自己的技术博客 1.背景 我挺喜欢写博客,但每一次将博客转移到公众号或者知乎,总是需要调整格式,不 ...