I’m setting up scripts that will allow multiple firing options on my weapons. The following function is meant to determine which script to use for the gun based on the fire mode.
Apparently C# doesn’t let me do a for loop in this way, is there another way I could do this without needing to define a size?
This is the error I’m getting:
Assets/fireingMode.cs(265,29): error CS1002: Expecting ‘;’
void getGunType(int t){
gScripts = transform.parent.GetComponents<Gun>();
for (Gun g in gScripts){
if(t == 0 g.isPrimaryWeap){
gScript1 = g;
}
else if(t == 1 !g.isPrimaryWeap){
gScript1 = g;
}
}