Quantcast
Channel: Questions in topic: "assetbundles"
Viewing all articles
Browse latest Browse all 312

[Asset Bundle] Split the prefabs into a single gameobject

$
0
0
Hello, does anyone know how to split the prefabs we get when we load in an assetbundle? When I get the prefabs I'm giving them a script but I wanted them to stay in a single gameobject for each to have their position and so on. I have to do this all by code because I am trying to do something automatic. void Start () { StartCoroutine("DownloadObject"); } IEnumerator DownloadObject() { Caching.CleanCache(); WWW www = WWW.LoadFromCacheOrDownload("file:///" + Application.dataPath + "/AssetBundles/bottle", 1); yield return www; AssetBundle bundle = www.assetBundle; AssetBundleRequest requestObjects = bundle.LoadAllAssetsAsync(); yield return requestObjects; for (int i = 0; i < requestObjects.allAssets.Length; i++) { GameObject bottles = requestObjects.allAssets[i] as GameObject; bottles.gameObject.AddComponent(); Instantiate(bottles); } }

Viewing all articles
Browse latest Browse all 312

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>