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!
Here is a great tutorial, that show you exactly how to do it: https://www.youtube.com/watch?v=KLaGkc87dDQ
Answer by CJCurrie
Feb 04, 2010 at 11:31 PM
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.
can you post it on a site plz so i can copy type it? ( srry im dutch i didnt knew the word for it! :P)
Hello CJCurrie, thanks for those tips, generally you used the GUI class, is there any other majority classes that did you use on you inventory? I would like to read more about those. thanks.
Answer by duck
Feb 04, 2010 at 09:11 PM
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"
i dont know if you're going to see this, but i learn from examples. I was wondering if you know where a project file is with an inventory system that i could download and look at to kinda figure it out?
DUCK DUDE, it's the fifth time i read the same sh*tty comment of you. you are helping noone and it seems that you collecting posts. if you don't have a piece of code or something just STFU.
@Kabel Says the guy who hasn't helped a single person yet? Duckets has helped literally thousands of people on this site, and he is absolutely correct in pointing out that this is a poor question - there is no 'one' solution to it, there are a ton of ways to go and it has been answered before several times. So perhaps focus a bit more on helping others (or at least asking proper questions, what the hell was that?) then on critiquing those who do.
@kabel Wow. Just wow. Marvels at how obnoxious a person can be. To pick on the second most helpful person on the site. Being new is no excuse for something like that, by contrast. Shakes head in sheer disbelieve
Told you already: Fix your attitude or leave.
Thanks for tip. I didnt know about Custom Unity3D Google Search.
Answer by slkjdfv
Jun 05, 2011 at 02:43 PM
http://forum.unity3d.com/threads/90871-advanced-inventory-system-example use this :), I made it.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
7 People are following this question.
EditorGUI, EditorGUILayout, GUI, GUILayout... pshhh... WHEN TO USE WHAT?!
Un-rendering/rendering animating + scaling + GUI Texture + sound effect?
How to use line break for GUI.Lable
GUI.HorizontalSlider not working