So I made a weaponChange script, and when I play it automatically switches to the secondary, without being able to switch back. Could someone tell me why that is?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class weaponChange : MonoBehaviour {
public GameObject primary;
public GameObject secondary;
private bool isPrimary;
void Start () {
primary.SetActive (true);
secondary.SetActive (false);
}
void Update () {
if (Input.GetButtonDown("Mouse ScrollWheel")) {
isPrimary = !isPrimary;
}
if (isPrimary == true) {
secondary.SetActive(false);
primary.SetActive(true);
}
if (isPrimary == false) {
primary.SetActive(false);
secondary.SetActive(true);
}
}
}