how to display the correct numbers of ammunition per weapons
Hello, I'm a beginner of unity and coding, when I have a probleme I check on internet but after an hour of reserching I didn't found any solution. My problem is: I have 2 weapons and a TextMeshProUGUI for display the ammo, I would like if I have my gun 1 to display the ammo of gun 1 and if I switch to gun 2 then the ammo switch to ammo of the gun 2.
I tried this :
         if (ammunitionDisplay != null && gameObject.activeInHierarchy == true)
         {
             ammunitionDisplay.gameObject.SetActive(true);
             ammunitionDisplay.SetText(bulletsLeft / bulletsPerTap + " / " + magazineSize / bulletsPerTap);
         }
         else
         {
             ammunitionDisplay.gameObject.SetActive(false);
         }
It did'nt work the ammo is displayed but when i switch for gun 2 the ammo stay. Thanks.
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                