- Home /
gameobject null
The following script always return null.here i try to get gameobject from asset bundle...
UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(@"file:\\xxxxxxx\Name.unity3d");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
var bundle = DownloadHandlerAssetBundle.GetContent(www);
// here i can get asset bundle next line return null
GameObject cube = bundle.LoadAsset< GameObject>("Cube");
yield return cube;
Instantiate(cube, new Vector3(0, 0, 0f), Quaternion.identity);
}
Comment
Answer by fffMalzbier · Jul 01, 2019 at 10:01 AM
unless your asset(prefab) does not have a extention its probable "Cube.prefab" instead of just Cube.