The question is answered, right answer was accepted
Hello, I need a good inventory system with item Pick up, Drop items and "I" button to open Inventory window.. Can you please help me with that cuz i searched but nothing helped me... Thank you :)
@MartinZahariev hey man, we would really appreciate it if you could choose an answer. Just hit the Checkmark to the left of the answer that solved your problem.
Hello, this tutorial might help you out: https://www.youtube.com/watch?v=KLaGkc87dDQ
Answer by vexe
Oct 05, 2013 at 07:45 AM
This isn't a site where you request/order stuff and have others do it for you, this is a site where you ask for solutions to problems you are having during whatever it is that you're working with. Do you really expect someone to answer you with a full inventory system? ;-)
Generally speaking, an inventory system involves having a Bag, with a sequence (a List perhaps) of Slot, where each Slot (or Slots, if you wanted your items to take more than one slot) has an Item - That's one way, Or if you wanted it to be gridless, you could immediately store the items inside the bag.
Anyway, here's a good inventory system from Brackeys (Free)
And here's a series that might help as well.
Sorry if I sounded mean, but users should know what kind of questions to ask, at least read the FAQ :)
TIP: Start small, and walk forward, it takes time. Use a good GUI system, like NGUI.
Seems like he was asking for help on an inventory system, not ordering one.
Answer by phxvyper
Oct 05, 2013 at 07:50 AM
Unfortunately, there isn't an inventory asset or script that you can just download. There MIGHT be one on the Unity Asset Store, but i doubt it'll be free.
An inventory system isn't entirely difficult to create, either.
A system I'm using involves creating a dictionary with slot numbers:
//Dictionary with a key of int that represents the slot number...
//...and a IMeleeWeapon type as the value that represents each melee weapon.
Dictionary<int, IMeleeWeapon> MeleeWeaponDictionary = new Dictionary<int, IMeleeWeapon>();
Having a GUI that represents the inventory is a little more complicated, but not that hard. If you're comfortable with Unity's GUI system, then this should be pretty easy! (Otherwise, do some research!)
A Drop System:
If its by Keypress, then it's relatively simple! However, it is dependent one how your game works in terms of inventory. In one of my Games, you can just pull out one of the guns you have in your inventory and then press a specific key to drop it. That would look something like this:
private IMeleeWeapon _currentMeleeWeapon;
public KeyCode DropWeaponKey = KeyCode.D;
//The weapon dictionary uses an ID : Object system.
//Every Object (weapon) has a Unique ID assigned to it.
//Every time a weapon is added to the dictionary,
//that Unique ID is assigned to the object's index.
public Dictionary<int, IMeleeWeapon> MeleeWeaponDictionary = new Dictionary<int, IMeleeWeapon>();
public void Update()
//Check if the key that is used to drop the current weapon was pushed
//If the key was pressed, remove the current melee weapon from the weapon dictionary.
If you need any other help, comment to the answer or email/PM me!
EDIT: I urge you to check out vexe's answer and the resources he links in his answer, they may be helpful.
Also, here are a few links on Unity's GUI System:
GUI Scripting Guide - Unity Docs
GUI Script Reference - Unity Docs
If you're confused with what i did with the Dictionaries, check out this MSDN page on them:
Dictionary(TKey, TValue) Class - MSDN Developer Network
Answer by ik1602
Feb 03, 2015 at 01:52 PM
Since I am making second advanced version, it would really use your opinion on my first asset http://goo.gl/6Bq4Ll DIABOLIC RPG INVENTORY-FREE
p.s. I intent to post same response trough the forum whenever similar questions are ask, since I need opinions on my second asset which is advanced version of this one. I hope I am not spamming, if someone thinks that I do please let me know I'll stop immediately.Thanks.
It seems relevant and appropriate, and hey, its free.
Answer by Cherno
Oct 05, 2013 at 10:26 PM
First of all, inventory scripts are are typically fairly complex, but don't get discouraged and just start small and you will slowly get what you want.
Here's a sample inventory system that includes some advanced stuff like putting on armor on body parts and displaying them on the model, but also basic stuff like item stacks. It's an older collection but worth a look.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
22 People are following this question.
How do I make my item only open if there is room in my Inventory?
How to build an Inventory where the items you pick up don't go in the slots in order but instead to a SPECIFIC slot in the inventory
Toggle Inventory script
create a Inventory system ?
inventory for FPS game