Unity 4.x Resource Packaging

Source: Internet
Author: User

Using system.collections;using system.collections.generic;using unityengine;using Unityeditor;public class  exportassetbundles:monobehaviour{//Add menu in Unity Editor [MenuItem ("Assets/build assetbundle from Selection")] static void Exportresource () {//Open Save panel, string path = Editorutility.savefilepanel ("Save Resource", String.        Empty, "New Resource", "Assetbundle"); if (path. Length > 0) {//Select the object to be packaged object[] selections = Selection.getfiltered (typeof (object), Selec            Tionmode.deepassets); Packaged Buildpipeline.buildassetbundle (selection.activeobject, selections, path, Buildassetbundleoptions.completea Ssets |        Buildassetbundleoptions.collectdependencies, buildtarget.standalonewindows); }} [MenuItem ("Assets/save Scene")] static void Exportscene () {String path = Editorutility.savefilepan El ("Save Resource", String.        Empty, "New Resource", "Unity3d"); if (path.       Length > 0) {     object[] selection = selection.getfiltered (typeof (Object), selectionmode.deepassets);            Specific to the project, you need to dynamically set string[] scenes = {"Assets/scene1.unity"}; Buildpipeline.buildplayer (scenes, Path, buildtarget.standalonewindows, Buildoptions.buildadditionalstreamedscenes        ); }    }}

  

Unity 4.x Resource Packaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.