2019-05-20 01:12:11 +08:00
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public static class PackageExporter
|
|
|
|
|
{
|
|
|
|
|
[MenuItem("Tools/Export Unitypackage")]
|
|
|
|
|
public static void Export()
|
|
|
|
|
{
|
|
|
|
|
// configure
|
2020-05-05 18:46:43 +08:00
|
|
|
|
var root = "UniTask";
|
|
|
|
|
var exportPath = "./UniTask.unitypackage";
|
2019-05-20 01:12:11 +08:00
|
|
|
|
|
|
|
|
|
var path = Path.Combine(Application.dataPath, root);
|
|
|
|
|
var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
|
2020-04-15 14:29:29 +08:00
|
|
|
|
.Where(x => Path.GetExtension(x) == ".cs" || Path.GetExtension(x) == ".asmdef" || Path.GetExtension(x) == ".json" || Path.GetExtension(x) == ".meta")
|
2019-05-20 01:12:11 +08:00
|
|
|
|
.Select(x => "Assets" + x.Replace(Application.dataPath, "").Replace(@"\", "/"))
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
UnityEngine.Debug.Log("Export below files" + Environment.NewLine + string.Join(Environment.NewLine, assets));
|
|
|
|
|
|
|
|
|
|
AssetDatabase.ExportPackage(
|
|
|
|
|
assets,
|
|
|
|
|
exportPath,
|
|
|
|
|
ExportPackageOptions.Default);
|
|
|
|
|
|
|
|
|
|
UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|