基于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. shell脚本中select循环语句用法

    shell脚本中select循环语句 1. 脚本中select的语法格式 select VAR in LIST do command1 command2 ... ... commandN done s ...

  2. 第08课:GDB 实用调试技巧( 上)

    本节课的核心内容: 将 print 打印结果显示完整 让被 GDB 调试的程序接收信号 函数明明存在,添加断点时却无效 将 print 打印结果显示完整 当使用 print 命令打印一个字符串或者字符 ...

  3. IPsec 9个包分析(主模式+快速模式)

    第一阶段:ISAKMP协商阶段 1.1 第一包 包1:发起端协商SA,使用的是UDP协议,端口号是500,上层协议是ISAKMP,该协议提供的是一个框架,里面的负载Next payload类似模块,可 ...

  4. Mybatis-Plus常用的查询方法--看这一篇就够了!!!

    前言: Mybatis-Plus作为Mybatis的增强,自己封装了很多简单还用的方法,来解脱自己写sql! 对于项目的搭建小编就不在说了,可以参考: SpringBoot+Mybatis-Plus的 ...

  5. JS006. 详解自执行函数原理与数据类型的快速转换 (声明语句、表达式、运算符剖析)

    今天的主角: Operator Description 一元正值符 " + "(MDN) 一元运算符, 如果操作数在之前不是number,试图将其转换为number. 圆括号运算符 ...

  6. SpringSecurity-Shiro-初见

    目录 简介 实战环境搭建 SpringSecurity 认证和授权 权限控制和注销 记住我 Shiro 快速上手 shiro整合mybais 简介 在 Web 开发中,安全一直是非常重要的一个方面. ...

  7. (xxl_job | quartz):XXL_JOB 对比 Quartz 一决高下!

    概述: XXL-JOB是一个轻量级分布式任务调度平台,其核心设计目标是开发迅速.学习简单.轻量级.易扩展. 现已开放源代码并接入多家公司线上产品线,开箱即用. 官方地址中文版:http://www.x ...

  8. Electron-vue项目使用 Inno Setup 创建安装包

    1.安装 Inno Setup 官网:https://jrsoftware.org/isinfo.php 2.打开 Inno Setup ,点击如下图Compli32.exe(首次安装默认打开) 3. ...

  9. 洛谷P1094——纪念品分组(简单贪心)

    https://www.luogu.org/problem/show?pid=1094 题目描述 元旦快到了,校学生会让乐乐负责新年晚会的纪念品发放工作.为使得参加晚会的同学所获得 的纪念品价值相对均 ...

  10. PTA 面向对象程序设计 6-1 引用作函数形参交换两个整数

    引用作函数形参交换两个整数 设计一个void类型的函数Swap,该函数有两个引用类型的参数,函数功能为实现两个整数交换的操作. 裁判测试程序样例: #include <iostream> ...