Quantcast
Channel: Answers by "murkantilism"
Viewing all articles
Browse latest Browse all 99

Answer by murkantilism

$
0
0
To answer your first question: No, you cannot pass multiple tower objects to the Instantiate() function, it simply doesn't support that. I highly suggest you [read the documentation on the function][1] before attempting to use it, because Instantiate can be an expensive thing if done at a high volume over a small number of frames. To answer your second question: there sure is. Like others have suggested, you can have a public List or GameObject[ ] array, and assign the towers you want to instantiate via the Inspector. Then a simple for or foreach loop to instantiate everything in said List or Array would be it! I don't see how all of this would create a "tower selector" though, it sounds like you want to just highlight an existing tower, not spawn a new one. You should clarify what you're trying to do so we can better help ya. [1]: http://docs.unity3d.com/ScriptReference/Object.Instantiate.html

Viewing all articles
Browse latest Browse all 99

Trending Articles



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