一、代码预编译
Unity 导入C# DLL、C\C++ DLL 等外部库:https://blog.csdn.net/l773575310/article/details/72461579
二、AB包
1.新建文件夹Editor
2.Inspector面板上设置AB
3.脚本打包(脚本要放在Editor下面)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadAB : MonoBehaviour
{
// Use this for initialization
void Start()
{
//本地加("file://") 网上不需要加
string pathPrefab = "file://" + Application.streamingAssetsPath + "/cubeprefab.unity3d";
StartCoroutine(LoadAllGameObject(pathPrefab));
}
IEnumerator LoadAllGameObject(string path)
{
WWW bundle = new WWW(path);
yield return bundle;
GameObject[] objs = bundle.assetBundle.LoadAllAssets<GameObject>();
yield return Instantiate(objs[0]);
bundle.assetBundle.Unload(false);
}
}