public class WeaponSwitch : MonoBehaviour
{
public int currentWeapon = 3;
public GameObject[] blockPrefabs;
public GameObject current;
// public GameObject[] blocks;
// Start is called before the first frame update
void Start()
{
blockPrefabs = new GameObject[currentWeapon];
}
// Update is called once per frame
void Update()
{
// checks for equipment
if (Input.GetAxis("Mouse ScrollWheel") > 0f) {
SelectWeapon();
Debug.Log("wheel works");
}
if (Input.GetAxis("Mouse ScrollWheel") < 0f) {
SelectWeapon();
}
}
public void SelectWeapon (){
//makes sure they match length
for (int i = 0; i < currentWeapon; i++)
{
Debug.Log(gameObject.name);
GameObject go = Instantiate(blockPrefabs*) as GameObject;*
go.transform.localScale = Vector3.one;
blockPrefabs = go;
}
}
}
basically, I want to have 3 prefabs that are weapons and be able to cycle through them using the middle mouse button.
hitting a wall on what I am doing wrong.
any help is appreciated.
thank you for your time.