Right now I’m using this script for switching weapons:0
public class ShowWeapon : MonoBehaviour
{
[SerializeField]
public GameObject item1;
[SerializeField]
public GameObject item2;
public bool ShowItem1;
public bool ShowItem2;
void Start()
{
ShowItem1 = false;
ShowItem2 = false;
}
void Update()
{
if (ShowItem1 == false) { item1.SetActive(false); }
if (ShowItem1 == true) { item1.SetActive(true); }
if (ShowItem2 == false) { item2.SetActive(false); }
if (ShowItem2 == true) { item2.SetActive(true); }
if (Input.GetKeyDown(KeyCode.Alpha1) && ShowItem1 == false) { ShowItem1 = true; ShowItem2 = false; }
if (Input.GetKeyDown(KeyCode.Alpha2) && ShowItem2 == false) { ShowItem2 = true; ShowItem1 = false; }
if (Input.GetKeyDown(KeyCode.R))
{
ShowItem1 = false; ShowItem2 = false;
}
}
}
and I set my desired gameobject through unity. But I want something more of a pickup system How would I go about doing this without changing this method? (More of a pickup that sets the gameobject)