01.程序集和资源加载_sed


01.程序集

01.程序集和资源加载_程序集_02


程序集引入

01.程序集和资源加载_程序集_03

01.程序集和资源加载_程序集_04


02.

01.程序集和资源加载_sed_05


01.程序集和资源加载_bundle_06

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<GameObject>("Attack"));
item.transform.SetParent(this.transform);
}