我正在编写一个生成资产包的构建实用函数。我已经实现了资产的增量构建。我希望确保当Unity3d版本有更新时,我希望确保再次构建所有资产包。谁能告诉我如何使用脚本(C#/Javascript)获得当前版本的Unity3d。谢谢
发布于 2013-07-21 05:07:21
似乎有几种方法可以做到这一点。
第一种方法是使用preprocessor definition's检查您的版本。我不认为这是你的问题的解决方案,但是,你可以这样使用它们:
// Specific version define including the minor revision
#if UNITY_2_6_0
// Use Unity 2.6.0 specific feature
#endif
// Specific version define not including the minor revision
#if UNITY_2_6
// Use Unity 2.6.x specific feature
#endif对您的情况更有帮助的是使用GetFullUnityVersion函数或Application.unityVersion变量。
using UnityEditorInternal;
...
DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0);
Debug.Log(
"Unity version = " + Application.unityVersion + "\n" +
"Full Unity version = " + InternalEditorUtility.GetFullUnityVersion() + "\n" +
"Version date = " + dt.AddSeconds(InternalEditorUtility.GetUnityVersionDate()));您可以将当前版本存储在一个文件中,并且每次检查版本是否相同。如果不同,您将不得不重新构建资产包。
希望它能帮上忙!
https://stackoverflow.com/questions/17742719
复制相似问题