Hi,
I’m trying to have an array of prefabs (loaded as assetReferences) and then accessing their components or normal things that we do with gameObjects.
But I don’t have a clue how to access them.
I tried this in order to have normal gameObjects and components access… but failed.
Any help?
public AssetReference assetToPlaceInScene;
public AssetReference[] assetsToPlace;
private List<GameObject> myObjects;
//################
private void Start()
{
//load single asset
assetToPlaceInScene.LoadAssetAsync<GameObject>();
//load array of assets? - Doesn't work
assetsToPlace[].LoadAssetAsync<GameObject>();
//load one item from the assetreference array - looks OK
assetsToPlace[0].LoadAssetAsync<GameObject>();
//assign assetReference loaded to GameObject List - Doesn't work
myObjects[0] = assetsToPlace[0].LoadAssetAsync<GameObject>();
}
Thanks for the support!!