make-unitypackage
v1.1.2
Published
make unitypackage! (browser compatible)
Downloads
297
Readme
make-unitypackage
make unitypackage! (browser compatible)
Install
https://www.npmjs.com/package/make-unitypackage
npm install make-unitypackageUsage
node:
import { makeUnityPackage } from "make-unitypackage";
import { FSO } from "fso";
const assets = new FSO("./Assets");
const files = [];
for (const entry of assets.join("Foo").childrenAllSync().filter(entry => !entry.isDirectorySync())) {
files.push({
path: entry.path,
data: new Uint8Array(entry.readFileSync()),
});
}
const unitypackage = makeUnityPackage(files);
new FSO("a.unitypackage").writeFileSync(unitypackage);browser:
import { makeUnityPackage } from "make-unitypackage";
const files = [
{
path: "Assets/Foo/Bar.cs",
data: new Uint8Array(new TextEncoder().encode("using UnityEngine; public class Bar : MonoBehaviour { public GameObject obj; }")),
},
{
path: "Assets/Foo/Bar.cs.meta",
data: new Uint8Array(new TextEncoder().encode("fileFormatVersion: 2\nguid: 02b4f861808199e4a904bba10680f423\n")),
}
];
const unitypackage = makeUnityPackage(files);