基于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. 微信小程序基础知识笔记

    微信小程序笔记 文件构成 全局文件 app.json 小程序全局配置文件,必要,自动生成 app.js 小程序入口JS文件,一般只需申明全局变量.处理生命周期以及版本升级即可,必要 app.wxss ...

  2. JDK1.8源码阅读笔记(2) AtomicInteger AtomicLong AtomicBoolean原子类

    JDK1.8源码阅读笔记(2) AtomicInteger AtomicLong AtomicBoolean原子类 Unsafe Java中无法直接操作一块内存区域,不能像C++中那样可以自己申请内存 ...

  3. IDEA使用教程+JRebel破解

    下载与安装 https://www.jetbrains.com 不装任何插件 破解码 K03CHKJCFT-eyJsaWNlbnNlSWQiOiJLMDNDSEtKQ0ZUIiwibGljZW5zZW ...

  4. Python习题集(六)

    每天一习题,提升Python不是问题!!有更简洁的写法请评论告知我! https://www.cnblogs.com/poloyy/category/1676599.html 题目 ''' 问题1.对 ...

  5. 为何GRE可以封装组播报文而IPSEC却不行?

    Author       : Email         : vip_13031075266@163.com Date          : 2021.01.24 Copyright : 未经同意不得 ...

  6. 查询同一张表符合条件的某些数据的id拼接成一个字段返回

    同一张表存在类似多级菜单的上下级关系的数据,查询出符合条件的某些数据的id拼接成一个字段返回: SELECT CONCAT(a.pid, ',', b.subid) AS studentIDS FRO ...

  7. 植入式Web前端开发方法

    上一篇,我讲述了植入式Web前端开发的基本情况,本篇就来探究其开发方法.以下假定CMS只能植入前端代码,并且需求规模是任意大小的. 代码形式 HTML代码是直接植入的毫无疑问,但除非植入的代码非常简短 ...

  8. golang sync.noCopy 类型 —— 初探 copylocks 与 empty struct

    问题引入 学习golang(v1.16)的 WaitGroup 代码时,看到了一处奇怪的用法,见下方类型定义: type WaitGroup struct { noCopy noCopy ... } ...

  9. 优雅的编码,使用Optional代替if-else

    Optional是JAVA8引入的类,它其实是一个包装类,可以对所有对象进行包装, 包括null,这个特性使得我们编码可以优雅的解决空指针异常. 先编写一些测试类 class Student { pr ...

  10. axios 取消请求 (如:用户登录失效,阻止其他请求)

    const CancelToken = axios.CancelToken; const source = CancelToken.source(); axios.interceptors.reque ...