Creating The Backend | Unity Inventory System Tutorial - Part 1

  Рет қаралды 38,514

Dan Pos

Dan Pos

2 жыл бұрын

🚨 Wishlist Revolocity on Steam! store.steampowered.com/app/27... 🚨 This series will teach you how to create a minecraft style inventory system in Unity 3D - this is includes stackable items, with a max stack size and the ability to split and combine stacks, and delete them from your inventory.
The current series is 8 episodes long - episodes releasing weekly here on KZfaq or get the full series plus project files on Patreon.
I show off everything we will be doing in Episode 0. I would love to expand this series if it's positively received with the following features:
- Dropping items onto the ground from your inventory.
- Saving and loading the inventory system.
- Selling & Buying items to an NPC.
- Crafting with inventory items.
If you'd like to see this features then let me know in the comments! 📁 Get access to my tutorial project files over on Patreon: / danpos
DISCORD NOTE: Since filming this series I have shut the Discord down, if you'd like help feel free to comment and I will try my best to get back to you.
❤️ Find me elsewhere on the internet:
Gumroad: gumroad.com/danpos_
Twitter: / danpos_
Instagram: / danpos_
📜 If you like this video and want to develop your skills I can highly recommend the following courses I have taken*:
Blender 2.8 Launch Pad Course: academy.cgboost.com/p/blender...
Substance Painter Launch Pad: academy.cgboost.com/p/substan...
Unreal Engine Blueprint Game Developer:
click.linksynergy.com/deeplin...
Unreal Engine C++ Developer:
click.linksynergy.com/deeplin...
Blender 3D Sculpting for Beginners: click.linksynergy.com/deeplin...
Beginning C++ Programming:
click.linksynergy.com/deeplin...
The Ultimate Guide to Game Development With Unity:
click.linksynergy.com/deeplin...
🖱️ This is the gear that I use to create*
Lenovo L24Q - QHD 24" Monitors: amzn.to/3s6Rba0
BONTEC Dual Monitor Arm: amzn.to/3s7tgr1
Logitech G213 Keyboard: amzn.to/38pe3tq
Logitech Z333 2.1 Speaker System: amzn.to/2LBdNic
Logitech 720p Webcam: amzn.to/39eyecG
Blue Yeti Microphone: amzn.to/2Le7EbB
Corsair VOID ELITE RGB Headphones: amzn.to/35i50bB
Corsair Harpoon RGB Optical Gaming Mouse: amzn.to/3olwCUV
Corsair iCUE LS100 Smart Lightin Strip Starter Kit: amzn.to/3q5mMXP
Corsair iCUE 465X RGB Case: amzn.to/3noyNpp
Corsair Hydro 100i RGB Cooling System: amzn.to/3q0K8xH
RTX 2060: amzn.to/35kewLF
Large Mouse Mat: amzn.to/2MEQdBn
Gel Wrist Rest: amzn.to/3bj3Pg0
Video Music Provided by EpidemicSound: www.epidemicsound.com/referra...
*These are affiliate links which means I receive a small commission if you decide to buy something - the price will be no different to you though! I would massively appreciate any support :) *

Пікірлер: 74
@DanPos
@DanPos 2 жыл бұрын
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!
@inkofthedragon
@inkofthedragon 2 жыл бұрын
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
@DanPos
@DanPos 2 жыл бұрын
@@inkofthedragon Save loading is up yes, no item equipping has been done
@inkofthedragon
@inkofthedragon 2 жыл бұрын
@@DanPos ok cool. Is that something you plan on incorporating?
@StanTheMovie
@StanTheMovie 8 ай бұрын
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.
@TapeStixxy
@TapeStixxy Жыл бұрын
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!
@skourge891
@skourge891 Жыл бұрын
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 ;)
@HB-wk6zj
@HB-wk6zj 2 жыл бұрын
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!!
@DanPos
@DanPos 2 жыл бұрын
You can do it!
@ecosmile4212
@ecosmile4212 Жыл бұрын
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!
@michaeltherandomperson9652
@michaeltherandomperson9652 5 күн бұрын
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.
@timurnikolaev1438
@timurnikolaev1438 2 жыл бұрын
hi started watching this playlist, so far so good, thanks!
@DanPos
@DanPos 2 жыл бұрын
Glad you enjoy it!
@bigt5481
@bigt5481 Жыл бұрын
Very helpful tutorial and greatly appreciated Dan
@DanPos
@DanPos Жыл бұрын
Glad it was helpful!
@thebarsambahrami
@thebarsambahrami Ай бұрын
Beat explaining ever, you got a loyal follower
@littlealienthings
@littlealienthings Жыл бұрын
Awesome video! Works well!
@DanPos
@DanPos Жыл бұрын
Glad it helped!
@timurnikolaev1438
@timurnikolaev1438 2 жыл бұрын
really like the quality of your code
@tehuster
@tehuster 2 жыл бұрын
Nice video dude! You've got a new sub.
@DanPos
@DanPos 2 жыл бұрын
Thanks for the sub!
@mixedtrigenito
@mixedtrigenito 2 жыл бұрын
this is incredibly educational
@DanPos
@DanPos 2 жыл бұрын
Glad you enjoyed it!
@DTTK
@DTTK Жыл бұрын
Learned a lot from your vid, thx
@DanPos
@DanPos Жыл бұрын
My pleasure!
@user-bj9vk1wl6q
@user-bj9vk1wl6q 2 жыл бұрын
thank you so much
@DanPos
@DanPos 2 жыл бұрын
No problem
@thenetimp
@thenetimp 6 ай бұрын
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.
@windbox1060
@windbox1060 2 жыл бұрын
It seems wonderful for now. I wonder what features are you gonna add?
@DanPos
@DanPos 2 жыл бұрын
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.
@AyyyyyyyyyLmao
@AyyyyyyyyyLmao Жыл бұрын
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?
@AbdulazizAlmawash
@AbdulazizAlmawash Жыл бұрын
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.
@DanPos
@DanPos Жыл бұрын
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
@mosasaurus2211
@mosasaurus2211 2 жыл бұрын
Someone hire this guy to minecraft
@DanPos
@DanPos 2 жыл бұрын
Cheers!
@duriniskawaiiiiiiiiiiiiiii7593
@duriniskawaiiiiiiiiiiiiiii7593 2 жыл бұрын
hey why i done the same thing you do but on InventoryHolder script i cant expand "Inventory System"
@Fuzzietomato1
@Fuzzietomato1 Жыл бұрын
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.
@KamekoTsuruga
@KamekoTsuruga Жыл бұрын
any time i try to pass something back using => unity just tells me its a read only file.
@memecraftgamer8311
@memecraftgamer8311 2 жыл бұрын
When I hit run it takes multiple minutes to run, then when it does the slots are not added, anyone know why this is.
@ThatGuyNamedBender
@ThatGuyNamedBender 2 жыл бұрын
Out of curiosity will you be using the legacy UI system in Unity or the UI Toolkit?
@DanPos
@DanPos 2 жыл бұрын
This will be using the legacy/built in UI - I haven't actually looked into the UI toolkit yet
@Daniel_Hochmuth
@Daniel_Hochmuth Жыл бұрын
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!
@dragonsagesummoner6071
@dragonsagesummoner6071 9 ай бұрын
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.
@TropicalCyc
@TropicalCyc Жыл бұрын
Im completely stuck, I cant expand Inventory system on Inventory holder at all.
@thebulletkin8393
@thebulletkin8393 3 ай бұрын
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?
@DanPos
@DanPos 3 ай бұрын
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?
@min_2187
@min_2187 10 ай бұрын
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!
@dronkarian
@dronkarian 8 ай бұрын
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.
@boomerslayer1
@boomerslayer1 2 жыл бұрын
""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
@DanPos
@DanPos 2 жыл бұрын
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 KZfaq
@boomerslayer1
@boomerslayer1 2 жыл бұрын
@@DanPos I'm using unity 2021 version, does the version matter?
@SofyCodes
@SofyCodes 2 жыл бұрын
anyplans to make the hotbar more functional? :D
@DanPos
@DanPos 2 жыл бұрын
Yes I have some Patreon exclusive bonus videos planned and this is one of them, along with equipment slots and controller support :)
@SofyCodes
@SofyCodes 2 жыл бұрын
@@DanPos anyplans to release it on the channal or is it patron only?
@DanPos
@DanPos 2 жыл бұрын
@@SofyCodes not currently but maybe in the distant future
@SofyCodes
@SofyCodes 2 жыл бұрын
@@DanPos I respect that :D I might become a patron once it come on there
@daveplay69
@daveplay69 Жыл бұрын
a do the same and i dont have any errors but it wont pick up or destroy
@RileyMacfarlane-cg3or
@RileyMacfarlane-cg3or 6 ай бұрын
did you ever find a fix for this??
@daveplay69
@daveplay69 5 ай бұрын
nope@@RileyMacfarlane-cg3or
@gigani...4363
@gigani...4363 Жыл бұрын
aggghhghh why does it want to convert int into InventoryItemData???
@laserbean00001
@laserbean00001 2 жыл бұрын
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.
@DanPos
@DanPos 2 жыл бұрын
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
@laserbean00001
@laserbean00001 2 жыл бұрын
@@DanPos or you can do public type var_name {get;}
@DanPos
@DanPos 2 жыл бұрын
@@laserbean00001 yeah but then you can't see it in the inspector that way
@laserbean00001
@laserbean00001 2 жыл бұрын
@@DanPos true true.
@laserbean00001
@laserbean00001 2 жыл бұрын
@@DanPos I would still use a public variable that "gets" the private serialized variable instead of a lambda function. i guess...
@ImportantClips2
@ImportantClips2 2 жыл бұрын
I have no ERROR but i cant pickup the item
@TwistedSisler
@TwistedSisler Жыл бұрын
Did you ever figure this out? I'm doing 2D as well and I have no errors but nothing happens when I walk over the item.
@TwistedSisler
@TwistedSisler Жыл бұрын
Nevermind, I just figured it out. You have to use OnTriggerEnter2D instead of OnTriggerEnter and pass a Collider2D instead of Collider.
@ImportantClips2
@ImportantClips2 2 жыл бұрын
does this work in 2D
@DanPos
@DanPos 2 жыл бұрын
Yes it will do, the only thing would the ground items and chest interaction etc, you would just need to replace any relevant 3D bits with their 2D equivalent
@ImportantClips2
@ImportantClips2 2 жыл бұрын
@@DanPos okay thanks!
@cateye2k7
@cateye2k7 Жыл бұрын
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 :(
Unity3D - Scriptable Object Inventory System | Part 1
31:31
Coding With Unity
Рет қаралды 323 М.
Дарю Самокат Скейтеру !
00:42
Vlad Samokatchik
Рет қаралды 7 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 10 МЛН
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 21 МЛН
Unity INVENTORY: A Definitive Tutorial
35:21
Coco Code
Рет қаралды 106 М.
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
This is GameDev
Рет қаралды 49 М.
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 516 М.
2 Python Developers VS $1000
15:04
PolyMars
Рет қаралды 1,8 МЛН
(FREE COURSE) Make awesome CUTSCENES in Unity using Timeline
41:52
How to Craft Items with Scriptable Objects! (Unity Tutorial)
19:46
КОРОЧЕ ГОВОРЯ, ИГРЫ - СБОРНИК OneTwo
34:06
ЧОП ДОСЫН ЖОҒАЛТЫП АЛДЫ (GTA V)
14:10
MANGO PLAY
Рет қаралды 28 М.