Problems with Set members in struct

Hey all,

I’ve posted this question in the forums aswell.

I’m having problems setting the values in a struct, within a function. This is the first time I’ve really worked with them so I’m probably missing something obvious.

I have a base character class, with an “ActorComponent” attached to it called player inventory, which will store the players ammo for certain types of weapons.
I also have a base weapon class with a reload function. Below are some pictures hopefully they can clear up what I’m trying to achieve better than I am able to explain it.

This function inside the inventory component that is attached to the character works, and returns the value I set (Here its set to 0, but it’s set to 100 on the instance attached to the player).

This function inside the weapon blueprint works out the reload amount, I had it working when I had a single integer variable for ammo. Each weapon has an Enum called AmmoType.

And this is the set function, that isn’t working, even after reloading, the players ammo stays at what it was set by default (100).

If I change from a struct to a simple integer, then it works and I am able to set it, but I want to use the struct if possible for flexibility with ammo types.

I hope I explained this well enough, if not just ask and I’ll try to clarify anything

I’m using UE4 4.9.2

Thanks in advance.

This question has been answered on the forums. I’ll provide the solution incase anyone else has the same issue.

The problem was I was setting a copy of the struct, rather than the actual struct.

Credit to “Urm92” for the solution

in my case I enabled check mark “pass-by-reference” in the function input for copying disable