Skip to content

Commit

Permalink
improv package exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed May 6, 2020
1 parent a78dc55 commit 66fa203
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/UniTask/Assets/Editor/PackageExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<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 assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
Expand All @@ -30,6 +39,11 @@ public static void Export()

UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath));
}

public class Version
{
public string version;
}
}

#endif
Binary file added src/UniTask/UniTask.2.0.1-preview2.unitypackage
Binary file not shown.

0 comments on commit 66fa203

Please sign in to comment.