How can I create an Inventory system with GUI?

Hi Everyone!

I've just started on my first video game made in unity. But i really need some help!. Can somebody send me a project or a tutorial on how to make a bag like gui? (i.e. an inventory system). Like to keep items in and be able to equip them from that area?.

Thanks in advance!

I just finished implementing a complex inventory/skills/hotbar system to my RPG, and while such a task is far too monumental to explain in a post, I can give you some tips.

  • First, don't use GUI.Button(). It probably includes more functionality than you need. When I prototyped the inventory system with ~30 buttons, my framerate dropped by 100fps! Instead, try to write your own coordinate system and clicking system. "IsInRectangle()" is a great custom function to have. I know it will be a lot of work, but hey, I saved 100fps by doing it.

  • Figure out what all you want it to do -- explicitly -- so that you won't have to change things later. This is a very intricate programming task, so you'll need to not make changes.

  • To save cpu cycles, you generally want to first check if the menus are open, then if the player's mouse is inside a selectable area, then do the calculations to figure out what the mouse is over and what to do if the mouse is clicked.

Creating a functioning inventory system is probably too large a task to be answered in a single question here, and would largely be specific to how the rest of your game was constructed.

However, you can use this Custom Google Unity3D search to search for the word "inventory". When I tried this, 9 of the first 10 results look like they are specifically to do with implementing Inventory systems in Unity:

Custom Unity3D Google Search

Custom Unity3D Search results for "Inventory"

http://forum.unity3d.com/threads/90871-advanced-inventory-system-example use this :), I made it.