Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Remove all objects that a certain type

$
0
0
At the moment using this, #pragma strict function OnMouseDown() { //Turns off yellow var yellow = GameObject.Find("Yellow(Clone)"); while (yellow != null) { yellow.SetActive(true); yellow = GameObject.Find("Yellow(Clone)"); } Debug.Log("Took off yellow"); //Turns on green var green = GameObject.Find("GreenSwitch(Clone)"); while (green != null) { green.SetActive(false); green = GameObject.Find("GreenSwitch(Clone)"); } } But this is highly unefficient because when an object is turned on that needs to be activated, the game freezes. Any other ideas?

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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