unity-game-engine - 获取当前unity3d版本

标签 unity-game-engine

我正在编写一个生成 Assets 包的构建实用程序函数。我已经实现了 Assets 的增量 build 。我想确保当 Unity3d 版本有更新时,我想确保再次构建所有资源包。谁能告诉我如何使用脚本(C#/Javascript)获取当前版本的 Unity3d。 谢谢

最佳答案

似乎有几种方法可以做到这一点。

第一种方法是使用 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()));

您可以将当前版本存储在一个文件中,并且每次都检查版本是否相同。如果不一样,您将必须重建资源包。

希望对你有帮助!

关于unity-game-engine - 获取当前unity3d版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17742719/

相关文章:

ios - Xcode 和 Unity 缺少库 'lGoogleUtilities'

c# - 为什么我的 2D 子弹的碰撞器没有与任何东西碰撞?

c# - MobileAppTracking 不起作用

variables - 从其他脚本访问变量

c# - BufferedWaveProvider 在 Unity 中不起作用

c# - 统一向计算着色器发送和获取 float 组

c# - 未找到 key 异常-Unity Json

javascript - 使用Unityscript读取鼠标点击Input.GetMouseDown

unity-game-engine - Unity着色器中的子程序 ".........."是什么?

c# - PUN 2 获取自定义属性