Trying to make a VERY simple inventory for unity2D. I would like to be able to pick up objects, drop them and have them fill up an inventory screen.
Can be made in either JS or C#
Jump to content
Posted 22 May 2014 - 07:21 PM
This question would probably best be asked on a Unity related forum, I don't have Unity experience in particular but a bit of advice about a generic inventory system.
Usually an inventory is little more than an array/collection of references to game objects, the actual implementation of building the inventory itself doesn't have anything to do with graphics or the platform really. Usually you'd make a class that represents an inventory, it'd have specific "interface" methods that allow you to interact with the inventory(sort it, add items to it, remove items, get an item in a particular slot) and your player object or something may contain an inventory object as part of its definition.
The only real part that would really be different in unity would be the graphical aspect, this varies a lot based on the game. For instance if you wanted to do something like Minecraft or a typical MMO or something where you have a "slot" based inventory where you drag pictures around, then you'd have an object representing an image slot of an item that could be dragged between slots in an inventory gui window, releasing an item would instruct the inventory to move the item(in code) so on, so forth.
The mechanical backend of any inventory will be similar across the board however, that should give you an idea of where to begin looking at least.
Posted 23 May 2014 - 02:01 AM
Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.
Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.