Article From:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class ExportAssetBundles : MonoBehaviour
    //Add a menu in the Unity editor[MenuItem ("Assets/Build AssetBundle From Selection")]Static void ExportResouRce (){/ / open the save panelString path = EditorUtility.SaveFilePanel ("Save Resource", stri)Ng.Empty, "New Resource", "AssetBundle");If (path.Length > 0){/ / selectionThe object to be packagedObject[] selections = Selection.GetFiltered (typeof (Object), SelectionMode.DeepAssETS);/ / packageBuildPipeline.BuildAssetBundle (Selection.activeObject, selection)S, path, BuildAssetBundleOptions.CompleteAssets, BuildAssetBundleOptions.CollectDependencies, BuildTarget.StandaloneWindows);}}[MenuItem ("Assets/Save Scene")]Static void ExpoRtScene (){String path = EditorUtility.SaveFilePanel ("Save Resource", string.Empty, "Ne")W Resource "," unity3d ");If (path.Length > 0){Object[] selection =Selection.GetFiltered (typeof (Object), SelectionMode.DeepAssets);/ / specific to the project, it needs to be set up dynamicallyString[] scenes = {"Assets/Scene1.unity"};BuildPipeline.BuildPlayer (scenes, P)ATH, BuildTarget.StandaloneWindows, BuildOptions.BuildAdditionalStreamedScenes);}}}


Link of this Article: Unity 4.x resource packaging

Leave a Reply

Your email address will not be published. Required fields are marked *