In my game my player has 2 weapons and in this level I want to make it so that once the player runs out of ammo the shotgun deactivates and the axe activates. Both weapons are child's of the player but this script is attached to the player. The shotgun deactivates but the axe doesn't activate and I don't know why. Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ammo : MonoBehaviour
{
public int ammo = 165;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(ammo == 0)
{
GameObject.Find("wp_shotgun").SetActive(false);
GameObject.Find("wp_axe").SetActive(true);
}
}
}