gunID1 = new ItemClass[10];
gunID1[0] = new ItemClass();
if (!gunID1[0])
Destroy (this.gameObject);
I was having some trouble with ItemClass, so I wrote this simple script to test if my classes were really being created. True to my suspicions, the GameObject destroyed itself. Ergo, gunID1[0] = new ItemClass(); doesn’t actually create an instantiation of the class.
Here’s the code for ItemClass:
#pragma strict
//extends System.ValueType;
var exist : boolean;
var clas : int;
var subClass : int;
var ty : int;
var activeVar : int;
var activeVar2 : int;
var modAmmo : int;
var modSlot1 : int;
var modSlot2 : int;
So basically, what I’m asking is what is wrong with my code? I REALLY don’t want to revert to using individual variables in separate arrays for the item system. Thanks!