Here I will list all the scripts relevant to my inventory system. There are a lot of scripts to this system as keeping track of these objects can get very complicated, especially when they are all piled on one script. This is still a work in progress, so more scripts may pop up or old scripts may become obsoleted.
Inven.cs handles the creation of the actual inventory via a 2D array. It handles the creation, storing, and manipulation of slots and the items stored in them. Methods like Pickup(), DeductOneFromSlot(), and EmptyInventorySlot() are just a few to give you an idea of what kind of operations this script handles.
InventorySpawner.cs simply spawns a UI for non-player UI objects, as the player's UI is already built regardless. This setup allows UI generation for storage devices to be dynamic and automatic.
Item.cs is a simple scriptable object that I create instances of for each "pickupable" item. It stores a multitude of information about the object, such as it's name, weight, image, etc. It also stores a reference to a prefab of what that object should look like when it is dropped. This setup allows adding additional stats to items very simple.
MultiClickButton.cs handles the interaction with the buttons that make up the UI aspect of the inventory. This script modifies the way that buttons typically behave and allows for some special interactions, like allowing left, right, and middle mouse click to be separate functions on the button. Furthermore, it would allow a click and drag function for left click, or a click and hold on others. Parts of this script were pulled from an online source and modified for my uses.
RecyclableItem.cs simply acts as a tag for whether or not an item is recyclable, as well as telling the system what this item is meant to recycle into.
StorageFinder.cs is essentially a workaround to allow me to call methods with arguments via Unity's event system. This script stores necessary references and sends the proper arguments to the right place when called through an event.
UiPlugger.cs creates the UI elements of the inventory as well as ensures that it stays up to date. It has a multitude of methods, such as SpawnButtonsPlayer(), ChangeItem(), and UpdateItem() that need to be called along methods elsewhere. For example, every time the player drops an item, ChangeItem(), UpdateItem(), or ClearSlot() must be called to ensure the UI reflects the change happening on the backend.
TempHolder.cs represents the object being "held" by the player. While an object is being held, it's data is stored in this temp slot. The slot the item was previously in is cleared. Then, when the player drops it on a new, empty slot, the empty slot is set to match the parameters of the temp slot. The temp slot is then cleared This effectively just moves an item from one slot to another. In the case that the player drops their held item on top of another item, a series of checks is done. If the temp slot item and the new slot item are two separate types of items, the new slot item is moved to the original empty slot, and the temp slot item is moved into the new slot, effectively trading places between the two items. This script also handles the logic behind the Shift click functionality, which allows the player to shift click an item to instantly move it between inventories.