Can i using AssetBundle.LoadAsync direct load a prefab from Assets folder? in Assets/Bundle folder has a prefab called "BGELement" , i did not want put it in to Resources folder and using Resource.Load to load it. the follow is my code ,but it make a error : NullReferenceException, the error line is that ab.LoadAsync()
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
void Start () {
StartCoroutine(NewLoadBGElement ());
}
IEnumerator NewLoadBGElement () {
string path = Application.dataPath + "/Bundle/BGElement";
AssetBundle ab = new AssetBundle ();
AssetBundleRequest abr = ab.LoadAsync(path, typeof(GameObject));
yield return abr;
GameObject newCube = Instantiate(abr.asset) as GameObject;
}
}