The code for packaging the scene is relatively simple.
The main is to call the Buildstreamedsceneassetbundle method, after executing the command will pop up the default current scene name of the menu, select the path, you can generate the. Unity3d resource bundle.
The record can be checked.
1 usingUnityengine;2 usingUnityeditor;3 4 Public classExportassetbundles5 {6[MenuItem ("assets/build IOS Streamed")]7 Static voidExportasset ()8 {9 //Clean CacheTen Caching.cleancache (); One A string[] levels =New string[] {editorapplication.currentscene};//assets/currentscenename.unity - - intLength = EditorApplication.currentScene.Split ('/'). Length; the - stringEditorpath = EditorApplication.currentScene.Split ('/') [Length-1]; - - //Get Current scene name + stringName = editorpath.substring (0, Editorpath.length-6); - + stringPath = Editorutility.savefilepanel ("Save Resource","", Name,"Unity3d"); A at if(! Path.equals (string. Empty) &&! Name.equals (string. Empty)) { - Buildpipeline.buildstreamedsceneassetbundle (Levels, Path, buildtarget.iphone); -Debug.Log (Name +"Packaging Success! The storage path is"+Path); - Assetdatabase.refresh (); - } - } in}
Editor Scenario Packaging Resources