Download

C++/ Widget - Doesn't how correct count, only 0 ? help

**I created C++ ammo counter, which basically lets the player shoot only 30 times(like a magazine). The class which holds the ammo variable is a Weapon class, not in the character class, the character only calls the weapon class to shoot. Moving on, I was trying to add the player ammo with the UI Widgets, however, I get 0 when I press play. P.S The ammo stop/limit system works, it does let the player only shoot 30 bullets, and it doesn’t matter if he does it in full auto or by pressing a lot of times, full auto uses a timer. The problem I have that the UI Widget shows 0 all the time doesn’t update how much the player has ammo or how much it used. Ammo system is in Weapon class, so in UI widget I cant cast it to BP_Player(Character blueprint), what I tried is casting it to BP_Player(Character blueprint) and then as character get the current weapon and then get the magazine, however it just shows 0 then.

Screenshots:

Fixed it myself, c++ mistake, didn’t exposed one variable which caused the error :slight_smile: