diff options
author | chai <215380520@qq.com> | 2024-05-23 10:08:29 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-05-23 10:08:29 +0800 |
commit | 8722a9920c1f6119bf6e769cba270e63097f8e25 (patch) | |
tree | 2eaf9865de7fb1404546de4a4296553d8f68cc3b /Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs | |
parent | 3ba4020b69e5971bb0df7ee08b31d10ea4d01937 (diff) |
+ astar project
Diffstat (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs')
-rw-r--r-- | Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs new file mode 100644 index 0000000..f070eb1 --- /dev/null +++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs @@ -0,0 +1,47 @@ +// Disable the warning: "Field 'DependencyCheck.Dependency.name' is never assigned to, and will always have its default value null" +#pragma warning disable 649 +using UnityEditor; +using System.Linq; + +namespace Pathfinding.Drawing.Util { + [InitializeOnLoad] + static class DependencyCheck { + struct Dependency { + public string name; + public string version; + } + + static DependencyCheck() { + var missingDependencies = new Dependency[] { +#if !MODULE_BURST + new Dependency { + name = "com.unity.burst", + version = "1.2.1-preview", + }, +#endif +#if !MODULE_MATHEMATICS + new Dependency { + name = "com.unity.mathematics", + version = "1.1.0", + }, +#endif +#if !MODULE_COLLECTIONS + new Dependency { + name = "com.unity.collections", + version = "0.4.0-preview", + }, +#endif + }; + + if (missingDependencies.Length > 0) { + string missing = string.Join(", ", missingDependencies.Select(p => p.name + " (" + p.version + ")")); + bool res = EditorUtility.DisplayDialog("Missing dependencies", "The packages " + missing + " are required by ALINE but they are not installed, or the installed versions are too old. Do you want to install the latest versions of the packages?", "Ok", "Cancel"); + if (res) { + foreach (var dep in missingDependencies) { + UnityEditor.PackageManager.Client.Add(dep.name); + } + } + } + } + } +} |