diff --git a/src/UniTask/Assets/Editor/PackageExporter.cs b/src/UniTask/Assets/Editor/PackageExporter.cs index 396373f..066693f 100644 --- a/src/UniTask/Assets/Editor/PackageExporter.cs +++ b/src/UniTask/Assets/Editor/PackageExporter.cs @@ -11,9 +11,18 @@ public static class PackageExporter [MenuItem("Tools/Export Unitypackage")] public static void Export() { - // configure var root = "Plugins/UniTask"; - var exportPath = "./UniTask.unitypackage"; + var version = Environment.GetEnvironmentVariable("UNITY_PACKAGE_VERSION"); + + var versionJson = Path.Combine(Application.dataPath, root, "package.json"); + if (File.Exists(versionJson)) + { + var v = JsonUtility.FromJson(File.ReadAllText(versionJson)); + version = v.version; + } + + var fileName = string.IsNullOrEmpty(version) ? "UniTask.unitypackage" : $"UniTask.{version}.unitypackage"; + var exportPath = "./" + fileName; var path = Path.Combine(Application.dataPath, root); var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) @@ -30,6 +39,11 @@ public static class PackageExporter UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath)); } + + public class Version + { + public string version; + } } #endif \ No newline at end of file diff --git a/src/UniTask/UniTask.2.0.1-preview2.unitypackage b/src/UniTask/UniTask.2.0.1-preview2.unitypackage new file mode 100644 index 0000000..21e1985 Binary files /dev/null and b/src/UniTask/UniTask.2.0.1-preview2.unitypackage differ