Referencing variables from ItemViewModules

There are many ways to do this.
Can you give an example of what your actual use case is, that should help me give you a better answer?

The ItemVIews are usually spawned at runtime. So you'll want to get reference to them dynamically. This has to be done in script. You can get the ItemViewSlots from the ItemViewSlotContainer (InventoryGrid, Hotbar, etc..). Item View Slots are usually prespawned at edit time, so you can reference them directly.
And then you can get the ItemView from the ItemViewSlot.

In most cases though you shouldn't need to get a reference to an ItemViewModule. You would instead have a custom ItemViewModule that does the thing you want on its own.

I hope that makes sense.
 
I'm basically trying to modify an int value that is calculated in a custom ItemViewModule, So when I reload a weapon using an item action the amount needed to reload that weapon is subtracted from the int value.
 
I see, the simplest way to do this would be to redraw the Inventory Grid and allow all ItemViews to refresh. And your custom ItemViewModule can then compute the new ammo value by retriving the data it requires.
Code:
inventoryGrid.Draw();
Normally the Inventory Grid should be drawn automatically when an ItemAction is used, or at least there should be an option that allows you to do it. If that's not the case let me know
 
Top