- Home /
Calling Game object from Element list?
I posted a question a little bit ago asking if there was something I was doing wrong. You were very helpful to direct me to another question. My goal with this is to select a random biome from my element list, and enable it [Well, sort of]. Is there something I am missing?
Preferably maybe changing the set active so I don't have like 20 biomes assets not active in my start at a time?
Here is the code.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SurfaceSelect : MonoBehaviour { public GameObject[] Biomes; public void Start() { SelectBiome(); } public void SelectBiome() { int i = Random.Range(0, Biomes.Length); Biomes[i].SetActive(true); } }
You will have to explain what does not work with your current script.
Simply disable the gameObjects before running this script, and obviously, don't forget to drag & drop the biomes gameObjects into the Biomes
field in the inspector.
What behaviour are you seeing? What behaviour are you expecting to see? What have you tried to fix it?
I thought I answered something about Biomes last week?