Skip to content

Commit

Permalink
add packageexporter to 1.8, #593
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Nov 5, 2019
1 parent e2e6aa5 commit fcaeeba
Showing 1 changed file with 31 additions and 0 deletions.
@@ -0,0 +1,31 @@
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
var root = "Scripts/MessagePack";
var exportPath = "./MessagePack.Unity.unitypackage"; // missing version:)

var path = Path.Combine(Application.dataPath, root);
var assets = Directory.GetFiles(path, "*", SearchOption.AllDirectories)
.Where(x => Path.GetExtension(x) == ".cs" || Path.GetExtension(x) == ".asmdef" || Path.GetExtension(x) == ".json" || Path.GetExtension(x) == ".meta")
.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));
}
}

0 comments on commit fcaeeba

Please sign in to comment.