I have loaded assetbundles. Every assetbundle includes some gameobjects, all of them tagged with activeAssetBundle. Now when I load an assetbundle I would like to get an array of all the objects. That way I can build a menu where the user can choose which object to spawn.
This is the coding where I load the assetbundle and test if it worked. If it worked I spawn the object and try to get all objects with FindGameObjectWIthTag. Still the array is empty:
if (path == null) //ist pfad befüllt?
{
Debug.Log("path variable in Button to load ab1 is not set");
return;
}
else
{
status = sLoadBundle.loadAssetBundle(path, out loadedAssetBundle); //Aufruf Funktion in Empty zum Laden der AB
if (status == false) //hat nicht funktioniert
{
Debug.Log("Can not load AB1 with path " + path);
return;
}
else //hat funktioniert
{
Debug.Log("Success with path " + path);
var prefab = loadedAssetBundle.LoadAsset("Cube");
Instantiate(prefab);
get3DObjects = GameObject.FindGameObjectsWithTag("activeAssetBundle");
return;
}
}