本文共 876 字,大约阅读时间需要 2 分钟。
01.程序集 程序集引入 02.using System.Collections;using System.Collections.Generic;using System.IO;using UnityEngine;using UnityEditor;public class AssetBundleEditor : MonoBehaviour{ [MenuItem("Tools/打包")] public static void Buid() { if (Directory.Exists(Application.streamingAssetsPath) == false) { Directory.CreateDirectory(Application.streamingAssetsPath); } BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); } }
void Start() { AssetBundle assetBundle=AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/Attack"); GameObject item=Instantiate(assetBundle.LoadAsset("Attack")); item.transform.SetParent(this.transform); }
转载地址:http://tfrxo.baihongyu.com/