Hey guys,
So im trying to make a weapon system where the player gun pick up a weapon, the idea that i have of this is as follows. The player has a GameObject called curGun. When the player interacts with another weapon through the IInteractable interface the following code runs and it is supposed to set the players curGun to null. But this is obviously not working. Anyways after the coroutine finishes, the players curGun is supposed to set be the same as the GameObject thisWeapon. If you guys know how to fix this, or of a better way to do this, id appreciate the help.
IEnumerator PickingUpGun()
{
playerC.curGun = null;
akm.SetActive(false);
yield return new WaitForSeconds(5);
akm.SetActive(true);
}
public void Interact()
{
print("You are unarmed");
StartCoroutine(PickingUpGun());
playerC.curGun = thisWeapon;
}