Few samples I made (UI Scaling, inventory, drag + resize panel)

Just a few things, somewhat edited, that I’ve worked on for fun.
I thought I’d share for anyone who was interested in looking at them to use, learn, or comment… doesn’t matter to me :slight_smile:

There is a GameItem (which is a ScriptableObject for an inventory item), a storageSlot class (as well as an inventorySlot class, which just adds 1 override).
The inventory slots display items, and have some code for moving items, swapping them, partial moves (splits); the splits however aren’t fully functional, and I wrote some code to split a stack by only 1 for this ‘package’. :slight_smile: But the code is there, more or less…
An Inventory class with methods to add, check, remove items… stuff like that.

There is some code to resize and drag a root game object. It can be given a min/max size (the max can be -1 = no restriction, other than screen space).

There is some code for scaling when the canvas changes dimensions, ie: resizable windows.

some stuff requires the camera be in screen space overlay to work. :slight_smile:

3263885–251801–SampleScene.unitypackage (31.1 KB)

2 Likes

thank you, this is worth studying to bring one’s programming skills up lol. i can’t rip much from it directly, but it’s more satisfying that way anyhow. my inventory is 50 slots long, not counting stackable items, so that’s part of it …

Ya, well you can just duplicate slots to add more in the editor :wink: lol

It could probably use some polish or TLC (my code) but it’s just some fun, and it works afaik… so that’s good. :slight_smile: