找回密码
 立即注册
查看: 311|回复: 0

[简易教程] unity lua获取时间戳xlua

[复制链接]
发表于 2021-4-21 18:40 | 显示全部楼层 |阅读模式
在lua脚本unity中:
  1. local onFrameTime =CS.UnityEngine.Time.time;--getLuaTime();--
  2.                             coroutine.yield(CS.UnityEngine.WaitForEndOfFrame());
  3.                             local perTime = CS.UnityEngine.Time.time-onFrameTime;
复制代码
在lua中获取时间戳:
  1. function getLuaTime()
  2.     local socket = require "socket"
  3.     local t0 = socket.gettime()
  4.     return t0;
  5. end
复制代码
--注意这里lua中获取的时间戳不准确
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-20 16:28 , Processed in 0.118705 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表