Serialized Array: Trying to wrap my head around it

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;
				}
			}

I’m not quite sure if I understand the question.

But If you want to iterate through the array it needs to be initialised with ‘new’

var array = new GunDefinition[]

Then you should be able to iterate.