Unity3d获取系统时间
程序员文章站
2023-12-24 15:40:06
unity是由unity technologies开发的一个让玩家轻松创建诸如三维视频游戏、建筑可视化、实时三维动画等类型互动内容的多平台的综合型游戏开发工具,是一个全面整...
unity是由unity technologies开发的一个让玩家轻松创建诸如三维视频游戏、建筑可视化、实时三维动画等类型互动内容的多平台的综合型游戏开发工具,是一个全面整合的专业游戏引擎。unity类似于director,blender game engine, virtools 或 torque game builder等利用交互的图型化开发环境为首要方式的软件其编辑器运行在windows 和mac os x下,可发布游戏至windows、mac、wii、iphone、windows phone 8和android平台。也可以利用unity web player插件发布网页游戏,支持mac和windows的网页浏览。它的网页播放器也被mac widgets所支持。
下面通过一段代码给大家介绍unity3d获取系统时间。
具体代码如下所示:
var gskin:guiskin; var str=""; var months:string[]=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]; var days:string[]= ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20", "21","22","23","24","25","26","27","28","29","30","31"]; var dnow:system.datetime; var i=0; function ongui() {if(gskin)gui.skin=gskin; guilayout.box("本地日期时间:"+system.datetime.now);//本地时间,12小时制的 guilayout.box("军事日期时间:"+system.datetime.now.tostring("yyyymmddhhmmss")); guilayout.box("utc日期时间:"+system.datetime.utcnow);//utc时间 guilayout.selectiongrid(system.datetime.now.month-1,months,3); guilayout.selectiongrid(system.datetime.now.day-1,days,10); guilayout.box(str+dnow.now.year+"年"+dnow.now.month+"月"+dnow.now.day+" 日"+" "+dnow.now.hour+"时"+dnow.now.minute+"分"+dnow.now.second+"秒"); }
以上代码就是关于unity3d获取系统时间的全部内容,代码附有注释,哪里写的不好的地方欢迎各位大侠提出宝贵意见。谢谢。