From 8722a9920c1f6119bf6e769cba270e63097f8e25 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 23 May 2024 10:08:29 +0800 Subject: + astar project --- .../Drawing/PackageTools/Editor/DependencyCheck.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Drawing/PackageTools/Editor/DependencyCheck.cs') 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); + } + } + } + } + } +} -- cgit v1.1-26-g67d0