So I am trying a serialized array used for selecting weapons. What’s the proper way to call or set that info from a method?
I’ve seen it working with a “for” loop and an “if (Input.GetKeyDown)” - but I’d like to change weapons based on collision, and am hoping to do that via subclass & overriding on a separate object you collide with.
public GunDefinition[] guns;
public int selectedGun;
[System.Serializable]
public class GunDefinition
{
public GunLauncher launcher;
}
public virtual void GunChooser (){
for (int i = 0; i < guns.Length; i++) {
// this doesn't work
selectedGun = 1;
}
}