Using Unityengine;
Using System.Collections;
Using Unityeditor;
<summary>
Simple Resource Packaging Editor
</summary>
public class Buildpacketeditor:editorwindow
{
[MenuItem ("Tools/packet/buildassetbundle-android")]
public static void Exportandroid ()
{
Importpacket (buildtarget.android);//Package to Android resources
}
[MenuItem ("Tools/packet/buildassetbundle-ios")]
public static void Exportios ()
{
Importpacket (Buildtarget.ios);//package to IOS resources
}
[MenuItem ("Tools/packet/buildassetbundle-win")]
public static void Exportwin ()
{
Importpacket (buildtarget.standalonewindows);//package to Wwindows Resource
}
static void Importpacket (Buildtarget target)
{
String path = Editorutility.savefilepanel ("Save Resource", "" "," New Resource "," Assetbundle ");//Displays the Save File dialog box and returns the selected path name.
if (path. Length! = 0)
{
object[] selection = selection.getfiltered (typeof (Object), selectionmode.deepassets);
if (selection. Length < 1)
{
Debug.logerror ("Please check the resources you want to package! ");
Return
}
Buildpipeline.buildassetbundle (Selection.activeobject, Selection, Path, buildassetbundleoptions.collectdependencies | Buildassetbundleoptions.completeassets, Target);
}
}
}
Unity Assetbundle Packaging Resource Tool