Unity3d获取系统时间
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获取系统时间的全部内容,代码附有注释,哪里写的不好的地方欢迎各位大侠提出宝贵意见。谢谢。
相关文章
C#集合Collections购物车Shopping Cart(实例讲解)
下面小编就为大家分享一篇C#集合Collections购物车Shopping Cart的实例讲解,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2017-12-12
最新评论