improv package exporter

master
neuecc 2020-05-07 07:38:41 +09:00
parent a78dc55875
commit 66fa203f7c
2 changed files with 16 additions and 2 deletions

View File

@ -11,9 +11,18 @@ public static class PackageExporter
[MenuItem("Tools/Export Unitypackage")] [MenuItem("Tools/Export Unitypackage")]
public static void Export() public static void Export()
{ {
// configure
var root = "Plugins/UniTask"; 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<Version>(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 path = Path.Combine(Application.dataPath, root);
var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
@ -30,6 +39,11 @@ public static class PackageExporter
UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath)); UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath));
} }
public class Version
{
public string version;
}
} }
#endif #endif

Binary file not shown.