Transferring items by an exact amount

When multiple instances of an item can be carried by the player, the item's properties let you choose between selecting all items - or one-at-a-time - to transfer to another slot.

This script allows the player to specify exactly how many to transfer, by way of a "pop up" menu that uses a slider to represent the amount.

To use it:


 * 1) In the Settings Manager' Inventory settings panel, check "Items can be re-ordered in Menus?".
 * 2) In the Inventory menu's properties, set the "Inventory box type" field to "Custom Script". Note that this requires all of the element's click behaviour to be handled via a custom script, so any interaction behaviour must be incorporated into the script below.
 * 3) In the Variables Manager, create a new Global Float variable named "TransferAmount".
 * 4) Create a new Menu named ItemAmount. This will be the "pop up" box that is used to set the amount being transferred.  Set its "Appear type" to "Manual".
 * 5) Inside this Menu, create a Slider element (named "Slider") and link its value to the TransferAmount variable. Optionally, create a Label that is also linked to this variable.
 * 6) Add a Button element named "OKButton", and set its "Click type" to "Custom Script".
 * 7) Paste the code below into a C# script named ItemTransfer.cs, and attach to a GameObject in the scene:

ItemTransfer.cs: