|
I'm pretty sure this is just a syntax problem, but an hour or so on google has not solved my problem. I'm trying to make a weapon selector. I can get it to work with some ugly code that amounts to (pseudocode):
needless to say this would be very ugly to do for a dozen weapons. I want to put them into a list on an array but I can't seem to make it work. I'm declaring these weapons as Transforms and assigning them in the inspector, but how do I stuff them in a list such that I can later instantiate an item in that list? I'm using boo which seems to be woefully underdocumented compared to the other two languages unity supports. Any assistance would be very helpful. my current attempts (which I commented out each time I tried a different strategy) look like this:
(comments are locked)
|
|
Just do
Then assign the prefabs to the array. Having them separately and as an array kind of defeats the purpose of using an array in the first place.
(comments are locked)
|

ok, I got it to work with List by just declaring "Private gunlist as List" and then under update starting with "gunlist as List = [cannon, minigun...]" I'm still curious how to do this with arrays or built in arrays, however. Just for future reference.