I know I'm like a year late to the party, but this is so helpful. I've watched a hundred of these tutorials and this is the first one I've found that actually explains the logic behind everything. It's much better than "Create an inventory system in 20 minutes!" where you just copy what they're doing in the video with no understanding of why at the end of it. Thanks so much for putting this up.
Do you have the save/load system posted already? Also do you have a video showing the equipping of, for example, a helmet? Like when you select the helmet in inventory, the specific helmet shows up on the player. And then unequip, removes the helmet model? Thanks
I have watched a lot of video tutorials in Russian and in English (about 20 in total). this video turned out to be the only one that clearly explains the theory of the inventory system. thank you very much to the author for the work done!
This is a great tutorial, and the fact that you're putting something of this quality and efficiency out for free on youtube is amazing. Thanks so much for this great tutorial!
I had followed another inventory tutorial a while ago that ended up not having the chest system implemented in it, thought id start a new inventory system from scratch again and this series was exactly what I needed. Thanks for providing this gem of a tutorial ;)
in MaxStackSize you don't need the else statement, if it's true it'll return true, otherwise it continues, and you can just return false by default. Could also consider making the item slot have a max stack size and not just the item. Since you may not want to allow stack sizes greater than X in the hot bar, for example a weap0n may be stackable in your pocket, but not in your hotbar.
I really like the tutorial so far. I have tried to make the system by myself and I am looking at how others implemented this. I learnt a lot just from these few videos.
I've understood everything so far! I hope the next parts will be as easy to comprehend, I was a bit scared at first because Inventory Systems looked really complicated.. but I start to think that it's not that much ! Thanks for these series!!
Other than everything shown in episode 0, if there's enough interest I've since got saving and loading working to save not just the inventory, but also which items on the ground have been collected.
I cant see the item system in the serialized fields either. EDIT - Figured it out. Make sure you added [System.Serializable] and [Serialized Field] in InventorySystem.cs as well.
Awesome tutorial. Quick question though - around 17:36 I'm a bit confused why there's ItemData on line 33 (with capital I) and itemData (with lowercase i) on line 40. I know it's initialized at the top but I don't get that line either. I'm fairly new to C# and this concept is not very clear to me. Thanks!
To answer your question it has to the with the privacy of the fields. The capital is public and points to the private fields that is lower case. This is to allow access security to the private field from other scripts.
So I'm having 1 issue and would appreciate it anyone could help me, but when i put the Inventory Holder script on the player it doesn't display the Inventory System list, it just shows None(Inventory System) I would appreciate any answers, Thanks in advance!
I had one problem where the Inventory system didnt show up at all. I had forgot to add [System.Serializable] at top of the Inventory system script. Maybe not the same problem you had.
Hi there, I'm currently looking for the best way to handle an inventory system that is built to handle a lot of items. I'm building a great interactive and scalable UI in the UI toolkit but I haven't quite decided on the best way to physically store this data. I am against the idea of using a scriptable object for every item created, as there will be a lot of items in the game and I'm worried about the long-term effects this will have on performance. I would love to hear your thoughts on these quick questions! A) Is this system in the tutorial is designed for mass item storage / handling? B) Can you point me in the direction of a system that is designed for mass item storage / handling?
Great tutorial! Thank you. Question, why did you choose to make 'serialized' fields then have other public variables to access those while we can just make the public ones and deal with them? thanks.
SerializeField only allows you set them in the inspector. Public would let you set them from other scripts which isn't good coding practice as you don't want one script directly changing a variable on another script
i also had this problem. he is coding this for a 3d game. if you are making a 2d game you should use OnTriggerEnter2D(Collider2D other) and also use 2d colliders. this was the problem in my script. i spent a whole day figuring this out
Been working on my own inventory system and have hit a roadblock that’s prevented any progress for the last month, wondered if you had any idea. Essentially, I’ve got an inventory that consists of slots like yours, but the type of item in the slot can be any one of three different types. These items can’t derive from each other because they are completely different items, but that means I’ve had constant errors when I try to get the item in slots and assign them. In general, when dealing with an inventory that can hold completely different types of item, how might I go about keeping it working?
They can't derive from each other but do they derive from a base class? Or do they derive directly from MonoBehaviour? If they just inherit from MonoBehavior then make a new base Item class, which your other items inherit from, and then have the inventory store a reference to the base item class?
""You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all"" item disappears, not adding items to InventoryHolder and getting this error? And I don't see stack size
As the error says, you're using the new keyword on a monobehaviour class, make sure you don't inherit from it in the classes where I remove it. Feel free to join the discord linked in the description and I'll try to help you some more, it's easier than on RUclips
why do you do public InventoryItemData ItemData => itemData;??? It's literally the same thing as making the itemData a public variable. Unless there's something I'm missing.
if you make a variable public, it can be accessed from any script but also be changed from any script. Doing public InventoryItemData ItemData => itemData means it can be accessed from other scripts but can't be changed by them. Further reading: www.w3schools.com/cs/cs_properties.php
nice tutorial but unfortunately doesnt work for me. I copy as you type without any deviation from it and get about 10 lines of error with error codes CS1014 CS1525 CS1002 and CS1513 popping up several times in InventorySlot.cs :(
I know I'm like a year late to the party, but this is so helpful. I've watched a hundred of these tutorials and this is the first one I've found that actually explains the logic behind everything. It's much better than "Create an inventory system in 20 minutes!" where you just copy what they're doing in the video with no understanding of why at the end of it. Thanks so much for putting this up.
Since filming this series I have got saving and loading working of the inventory system so if you'd like to see that let me know!
Do you have the save/load system posted already? Also do you have a video showing the equipping of, for example, a helmet? Like when you select the helmet in inventory, the specific helmet shows up on the player. And then unequip, removes the helmet model? Thanks
@@inkofthedragon Save loading is up yes, no item equipping has been done
@@DanPos ok cool. Is that something you plan on incorporating?
I have watched a lot of video tutorials in Russian and in English (about 20 in total). this video turned out to be the only one that clearly explains the theory of the inventory system. thank you very much to the author for the work done!
This is a great tutorial, and the fact that you're putting something of this quality and efficiency out for free on youtube is amazing. Thanks so much for this great tutorial!
I had followed another inventory tutorial a while ago that ended up not having the chest system implemented in it, thought id start a new inventory system from scratch again and this series was exactly what I needed. Thanks for providing this gem of a tutorial ;)
in MaxStackSize you don't need the else statement, if it's true it'll return true, otherwise it continues, and you can just return false by default. Could also consider making the item slot have a max stack size and not just the item. Since you may not want to allow stack sizes greater than X in the hot bar, for example a weap0n may be stackable in your pocket, but not in your hotbar.
I really like the tutorial so far. I have tried to make the system by myself and I am looking at how others implemented this. I learnt a lot just from these few videos.
I've understood everything so far! I hope the next parts will be as easy to comprehend, I was a bit scared at first because Inventory Systems looked really complicated.. but I start to think that it's not that much ! Thanks for these series!!
You can do it!
Beat explaining ever, you got a loyal follower
I thought I knew enough C# until I saw this guy.
hi started watching this playlist, so far so good, thanks!
Glad you enjoy it!
Very helpful tutorial and greatly appreciated Dan
Glad it was helpful!
really like the quality of your code
Awesome video! Works well!
Glad it helped!
Nice video dude! You've got a new sub.
Thanks for the sub!
this is incredibly educational
Glad you enjoyed it!
It seems wonderful for now. I wonder what features are you gonna add?
Other than everything shown in episode 0, if there's enough interest I've since got saving and loading working to save not just the inventory, but also which items on the ground have been collected.
Someone hire this guy to minecraft
Cheers!
Learned a lot from your vid, thx
My pleasure!
hey why i done the same thing you do but on InventoryHolder script
i cant expand "Inventory System"
I cant see the item system in the serialized fields either.
EDIT - Figured it out. Make sure you added [System.Serializable] and [Serialized Field] in InventorySystem.cs as well.
Awesome tutorial. Quick question though - around 17:36 I'm a bit confused why there's ItemData on line 33 (with capital I) and itemData (with lowercase i) on line 40. I know it's initialized at the top but I don't get that line either. I'm fairly new to C# and this concept is not very clear to me. Thanks!
To answer your question it has to the with the privacy of the fields. The capital is public and points to the private fields that is lower case. This is to allow access security to the private field from other scripts.
So I'm having 1 issue and would appreciate it anyone could help me, but when i put the Inventory Holder script on the player it doesn't display the Inventory System list, it just shows None(Inventory System)
I would appreciate any answers,
Thanks in advance!
I had one problem where the Inventory system didnt show up at all. I had forgot to add [System.Serializable] at top of the Inventory system script. Maybe not the same problem you had.
any time i try to pass something back using => unity just tells me its a read only file.
Hi there, I'm currently looking for the best way to handle an inventory system that is built to handle a lot of items.
I'm building a great interactive and scalable UI in the UI toolkit but I haven't quite decided on the best way to physically store this data.
I am against the idea of using a scriptable object for every item created, as there will be a lot of items in the game and I'm worried about the long-term effects this will have on performance.
I would love to hear your thoughts on these quick questions!
A) Is this system in the tutorial is designed for mass item storage / handling?
B) Can you point me in the direction of a system that is designed for mass item storage / handling?
Great tutorial! Thank you.
Question, why did you choose to make 'serialized' fields then have other public variables to access those while we can just make the public ones and deal with them? thanks.
SerializeField only allows you set them in the inspector. Public would let you set them from other scripts which isn't good coding practice as you don't want one script directly changing a variable on another script
a do the same and i dont have any errors but it wont pick up or destroy
did you ever find a fix for this??
nope@@RileyMacfarlane-cg3or
i also had this problem. he is coding this for a 3d game. if you are making a 2d game you should use OnTriggerEnter2D(Collider2D other) and also use 2d colliders. this was the problem in my script. i spent a whole day figuring this out
Been working on my own inventory system and have hit a roadblock that’s prevented any progress for the last month, wondered if you had any idea.
Essentially, I’ve got an inventory that consists of slots like yours, but the type of item in the slot can be any one of three different types. These items can’t derive from each other because they are completely different items, but that means I’ve had constant errors when I try to get the item in slots and assign them. In general, when dealing with an inventory that can hold completely different types of item, how might I go about keeping it working?
They can't derive from each other but do they derive from a base class? Or do they derive directly from MonoBehaviour?
If they just inherit from MonoBehavior then make a new base Item class, which your other items inherit from, and then have the inventory store a reference to the base item class?
thank you so much
No problem
Im completely stuck, I cant expand Inventory system on Inventory holder at all.
""You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all"" item disappears, not adding items to InventoryHolder and getting this error? And I don't see stack size
As the error says, you're using the new keyword on a monobehaviour class, make sure you don't inherit from it in the classes where I remove it.
Feel free to join the discord linked in the description and I'll try to help you some more, it's easier than on RUclips
@@DanPos I'm using unity 2021 version, does the version matter?
When I hit run it takes multiple minutes to run, then when it does the slots are not added, anyone know why this is.
Out of curiosity will you be using the legacy UI system in Unity or the UI Toolkit?
This will be using the legacy/built in UI - I haven't actually looked into the UI toolkit yet
anyplans to make the hotbar more functional? :D
Yes I have some Patreon exclusive bonus videos planned and this is one of them, along with equipment slots and controller support :)
@@DanPos anyplans to release it on the channal or is it patron only?
@@SofyCatYT not currently but maybe in the distant future
@@DanPos I respect that :D I might become a patron once it come on there
why do you do
public InventoryItemData ItemData => itemData;???
It's literally the same thing as making the itemData a public variable. Unless there's something I'm missing.
if you make a variable public, it can be accessed from any script but also be changed from any script. Doing public InventoryItemData ItemData => itemData means it can be accessed from other scripts but can't be changed by them. Further reading: www.w3schools.com/cs/cs_properties.php
@@DanPos or you can do public type var_name {get;}
@@laserbean00001 yeah but then you can't see it in the inspector that way
@@DanPos true true.
@@DanPos I would still use a public variable that "gets" the private serialized variable instead of a lambda function. i guess...
aggghhghh why does it want to convert int into InventoryItemData???
nice tutorial but unfortunately doesnt work for me. I copy as you type without any deviation from it and get about 10 lines of error with error codes CS1014 CS1525 CS1002 and CS1513 popping up several times in InventorySlot.cs :(