Search Unity

How do you code in ammo ui using low poly fps kit

Discussion in 'Scripting' started by darkange363, Feb 24, 2018.

  1. darkange363

    darkange363

    Joined:
    Feb 23, 2018
    Posts:
    2
    Im very new to coding.I recently got a kit called low poly fps kit and im trying to create a ammo ui that shows the ammo in the mag as well ass an ammount of ammo the character has and im trying to make it so when he reloads it takes away from his ammo hes holding and....you know how ammo ui works. but it keeps displaying the amount of bullets in the mag and then the same number on the right side and when ever i try to change the ammo hes holding it changes the ammo in the mag help please??


    Code (CSharp):
    1. //Ammo left
    2.     public int currentAmmo;
    3.  
    4.     [System.Serializable]
    5.     public class meleeSettings
    6.     {
    7.         [Header("Melee Weapons")]
    8.         //If the current weapon is a melee weapon
    9.         public bool isMeleeWeapon;
    10.  
    11.     }
    12.     public meleeSettings MeleeSettings;
    13.  
    14.     [System.Serializable]
    15.     public class shootSettings
    16.     {
    17.         [Header("Ammo")]
    18.         //Total ammo
    19.         public int ammo;
    20.        
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    When you're very new to Unity, it's a good idea to start here: https://unity3d.com/learn
    You can interweave some learning there, with your own game, but I think it will help you along the way.

    I don't know anything particular about that kit, but if you have 2 variables then you should make sure each one is displayed by its own Text. I'm not sure what else I can offer beyond that.

    Do you have any more code that you've tried, as perhaps that may shed some light for anyone who comes to read this /assist you?
     
  3. darkange363

    darkange363

    Joined:
    Feb 23, 2018
    Posts:
    2
    i could show the whole line of code that is in the script thank you