Inventory System in Unity Tutorial (Part 9) - Unity3D C# Tutorial

preview_player
Показать описание
Learn how to create an inventory system in Unity.

This series will focus on creating an inventory system much like systems in modern RPGs with item icons, tooltips, drag-and-drop rearranging, and more. An inventory system can be quite a confusing topic for most and I hope this series will answer most of the questions.

Inventory System Tutorial is a unity inventory tutorial that aims to explain the complexity of inventory systems so that even novice programmers will understand.

Part 4: Item Icons, Item Constructor, Inventory Grid

Download the item icons by Ails:

Follow me on Twitter:

Website:
Рекомендации по теме
Комментарии
Автор

I can't even express enough how helpful this tutorial series was to me. I'm working on a game that, not only was I able to build a very solid inventory system for, but I also learned the principles needed to build a crafting and equipment interface. Thanks so much for making these videos. When I publish my game, I'll be sure to credit you and I'll even send you a link if you'd like.

zackpeterson
Автор

I've been trying to learn a lot more about unity and C# and I have to give your inventory tutorials a big thumbs up. While this last one was a bit more difficult and lacked that finesse the rest had, these tutorials, over all, really helped me get a handle on doing all this stuff in Unity/C#. The idea of me making an inventory ( let alone any working multi - method system that worked was similar to the idea of a dolphin trying to walk on land before. Most of the tutorials I was trying/ watching were confusing, skipped over things, etc. So... THANKS :D

I am kinda sad there isn't more T-T

ysayde
Автор

This inventory system just keeps growing :)

MasterIndieVR
Автор

So helpful! Please make more! Im figuring out how to transfer items from a cargo container to the player inventory, thank so much. If you find the time, please continue!

cesarrc
Автор

WOW. You not having the same code really throws this all for a loop.

AndiBLEH
Автор

I have improved fairly much on this 'project' from what it gets up to in this video... I have used a custom skin to make the inventory look nicer. I have also changed things around like using windows and layouts instead of normal boxes... I have also implemented an equipment window where you can equip items of specific types to specific slots in the equipment window. There's still a few things that I could not get to work out but if anyone is interested in the files, PM me. I do not believe my code is the most efficient way of doing what I have done, but everything I have implemented, works nicely.

Thanks doing this in the first place and can't wait to see what you got next

dathstalker
Автор

Still waiting for part 11 :v hoping that there is going to be a tutorial that shows how to create items on the ground and pick them up, and if more specifically, make monsters drop items randomly? xD

ZynnieZHU
Автор

These are some of the best Tutorials I've watched to date on unity, my question is if you wanted to add drag&drop from one inventory(players) to another say a treasure chest, would you create a separate script to manage its inventory and attach it to the chest? if so how would you handle passing the Item to the chest's inventory from the players? Thank you so much for your tutorials, and AMP Inventory.

Emanth
Автор

Hey man! Loving this. Has taught me sooo much!

Btw, how would you go about making it so that if mouse 1 (right mouse) is clicked, instead of the tooltip showing up, it brings up a menu and can be used to "drop" / "consume" etc.... I'm not asking you do make the drop / consume function ( because this will change for every game), but how to show these workable buttons in a tooltip kind of way :)
Hope that makes sense? :P

sirkaz
Автор

Hello AwfulMedia! I wanted to say, as a new user of Unity and coding in C#, your media is certainly not awful, and has in fact been incredibly helpful to my learning experience.

I am having a little problem with the equivalent to your When I call the method, the code has no trouble compiling, but when I try to actually use the item, I get a Null Reference Exception. I know this is probably the most common error there is, I'm just not sure what I'm doing wrong. The object I'm referencing should definitely not be null. Should I be doing something along the lines of getComponent<PlayerStats>? If so, not entirely sure how to go about it.

Let me know if you have any advice at all. Thanks so much!

treyfrancis
Автор

Clad to see another one. I'm working on creating the design of my inventory, but I'm making it rely on the screen dimensions to make it flexible. I'm also doing well in making a script to swap material textures and colors to make custom characters. Once I have a character I'll upload a vid.

PKFacade
Автор

I've been following this series, and it helped me a lot, although I'm using javascript so i have to translate it to javascript. Could you show us how to equipped items in a different slot, or putting items in a chest.. Thanks, keep it up.. cheers.

Althe
Автор

If I am bothering you, I will stop it but I am reaaaally excited to make like inventory system! I try to make your code to convert in my own inventory, but it isn't go well so I have lots of question to ask you them.

skydenny
Автор

Hi Austin. This will probably be off-topic but I have a question for you and don't know how to catch your attention. Do you remember, in your "Making a Simple Game in Unity" tutorial, that problem with the gravity making the player move in a wrong axis a little bit? Did you get a way to fix it or at least to know what the problem is? Because it's happening exactly the same to me and it's pissing me off.
Or if anyone else reading this knows what I'm talking about, I accept any kind of help.
Thanks.

ismaelportillo
Автор

Thanks!! I changed it up a tad bit and also wanted to know what exactly do we need the 'slots' list for? I got rid of it and just using the 'inventory' list, everything still works the same

dathstalker
Автор

Realy nice Tutorial !
I hab a problem with drag & drop. So if i had an item sticked to the mouse an than close the inventory - this item still sticked on the mouse cursor.

I did the following:

if && !draggingItem)
{
showInventory = !showInventory;
}

is that way ok ?

daimonicon
Автор

Hey, great tut! anyway, where exactly do i put this when im using the original code for the print ("Clicked") part? i tried putting it in the for loop under DrawInventory but it prints out "Clicked 20" which i assume is the number of slots.

alphardconsencino
Автор

Could you teach me how can I add a cooltime for the potion? You know, in most of games there is a cooltime for the potion to keep player from drinking a lot so that they couldn't die.

skydenny
Автор

I think your inventory should not do anything with consumables, except alert the player controller what item was consumed. The player controller can then do with it what it wants:

- assign an effect to the player
- assign an effect to a worn item
- etc

amazium
Автор

For anyone having the problem with if(item.itemType == Item.ItemType.Consumable) not working. if you are using the old inventory code he used. Try This. It Worked for me.

if(slots[i].itemType == Item.ItemType.Consumable) ps. notice the lowercases and uppercases in the line of code.

hopes this helps.

jayebirdgaming
join shbcf.ru