i am using the new Fps Tamplate in Ue 5.2
what FYI is terrible to work with
but i run in to a problem when i want to add a weapon count to the UI with casting to the default BP_Weapon_Component because i cant seem to find out what to add in the object pin
Where is the weapon component you’re looking for? Which actor owns it? Casting is not a way of finding something - this is your job. What if there are 3 weapon components - which one do you mean?
Also, is it necessary to make a hard reference? Would it be easier to: update ammo → update widget instead?
I know the system. It’s versatile and a great starting point. Why not create the widget in the weapon component. It’s the weapon component that has the ammo and keeps track of it, right?
All of this is compartmentalised in the comp, each weapon has its own widget. Makes things transparent. It’s event driven, no casting, it happens only once when the ammo count changes rather than 120 times per second in case your next step was to bind a function to a text block…
Avoid having widgets pull data out of somewhere, it’s tedious work. Widgets’ job is to display what you send them and, most importantly, you should decide when the update happens.
You already have all the necessary ammo counting functionality in the component, which is great.
Since you’re following a 3d widget tut of some kind, how do you attach it to the spawned weapon component? Do you even do that? There is major differences of how one would set up comms between a regular widget vs a widget components.
Perhaps do tell more about how the widget component is supposed to work.
Have the weapon dispatch ammo count to the player’s widget component. This is using the same Custom Event as before. This way any weapon can send anything to the same widget the player owns.