C#添加编译时间
2017-11-28 14:04
281 查看
using System.Reflection; using UnityEngine; using System.Collections; [assembly:AssemblyVersion( "1.0.*" )] [RequireComponent(typeof(UnityEngine.UI.Text))] public class BuildDate : MonoBehaviour { [Tooltip("Date/time format.")] public string format = "g"; // see: https://msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.110%29.aspx void Start() { GetComponent<UnityEngine.UI.Text>().text = BuildDate.ToString(format); } public static System.Version Version() { return Assembly.GetExecutingAssembly().GetName().Version; } public static System.DateTime Date() { System.Version version = Version(); System.DateTime startDate = new System.DateTime( 2000, 1, 1, 0, 0, 0 ); System.TimeSpan span = new System.TimeSpan( version.Build, 0, 0, version.Revision * 2 ); System.DateTime buildDate = startDate.Add( span ); return buildDate; } public static string ToString(string format=null) { System.DateTime date = Date(); return date.ToString(format); } } 转自:http://luminaryapps.com/blog/showing-the-build-date-in-a-unity-app/
相关文章推荐
- C#获取程序集的版本号和最后编译时间
- 为notepad++添加g++编译器编译objc/c/c++/C#
- c#中如何将记录项目的最后编译时间
- linux 程序、动态库、静态库内部添加版本号和编译时间
- 转利用_DATE_和_TIME_宏在keil中添加编译日期和时间到C51程序中
- linux程序 动态库 静态库内部添加版本号和编译时间
- 为notepad++添加g++编译器编译objc/c/c++/C#
- linux 程序、动态库、静态库内部添加版本号和编译时间详解
- 为notepad++添加g++编译器编译objc/c/c++/C#
- C#winform项目添加引用编译文件
- Android之版本-自动添加编译时间-自动修改版本号
- C#工程添加了DLL编译运行时却提示”无法加载DLL“的解决方案
- GDAL2.0编译之添加HDF库编译C#版本
- C#-ListView控件中列添加控件ComboBox,控件TextBox,添加时间选择列DateTimePicker
- android 添加库的编译时间
- 添加Bugly后编译时间很长很慢的原因
- 转利用_DATE_和_TIME_宏在keil中添加编译日期和时间到C51程序中
- c#对时间的处理(待添加)
- C#添加测量运行时间
- 给vc添加编译时间计时