No video

Finishing The Backend | Unity Inventory System Tutorial - Part 2

  Рет қаралды 13,392

Dan Pos

Dan Pos

Күн бұрын

🚨 Wishlist Revolocity on Steam! store.steampow... 🚨 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/da...
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.cgboos...
Substance Painter Launch Pad: academy.cgboos...
Unreal Engine Blueprint Game Developer:
click.linksyne...
Unreal Engine C++ Developer:
click.linksyne...
Blender 3D Sculpting for Beginners: click.linksyne...
Beginning C++ Programming:
click.linksyne...
The Ultimate Guide to Game Development With Unity:
click.linksyne...
🖱️ 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.epidemicso...
*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 :) *

Пікірлер: 71
@benhoppe3889
@benhoppe3889 4 ай бұрын
The way you explain and name things is much easier than the few other videos that I have seen.
@DanPos
@DanPos 4 ай бұрын
Thank you!
@sarahreen7016
@sarahreen7016 Жыл бұрын
I know this is an older video, but I just wanted to say thank you for creating such a clean and concise video with excellent coding. I've learned a lot from this and your other videos :)
@DanPos
@DanPos Жыл бұрын
Glad it was helpful!
@StanTheMovie
@StanTheMovie 9 ай бұрын
Lovely burp at 1:50.
@Legionope
@Legionope 5 ай бұрын
Lol xD
@SteveTheExploiter
@SteveTheExploiter 2 жыл бұрын
Great job so far! I know some people might get impatient, but understanding how it all works allows you to make changes to suit your needs.
@DanPos
@DanPos 2 жыл бұрын
Thanks Steve glad you're enjoying it so far!
@JonnoTheBonno
@JonnoTheBonno 2 жыл бұрын
Gold dust this tutorial series, thank you.
@DanPos
@DanPos 2 жыл бұрын
Thanks :D
@lindenwoodford1110
@lindenwoodford1110 2 жыл бұрын
This was such a great tutorial! Thanks for the hard work put into making it, I can't wait to watch the entire series! ^^
@DanPos
@DanPos 2 жыл бұрын
Thanks so much! Hope you enjoy the rest of the series :)
@tehuster
@tehuster 2 жыл бұрын
If the rest of the series is of a similar quality I will support you on patreon. Great work dude. I hope you will address the issues that will occur when the amountToAdd is > 1. If not it's still a great system to build upon.
@DanPos
@DanPos 2 жыл бұрын
Thanks, will do! I'm not sure I do as each option works with just adding one to the item as that was the easiest route, though wouldn't be hard to implement if you did want to see that.
@tehuster
@tehuster 2 жыл бұрын
@@DanPos That's alright it's, like you said, not hard to implement.
@StanTheMovie
@StanTheMovie 9 ай бұрын
Brilliant. Thanks again. I'm actually following this one!
@bigt5481
@bigt5481 Жыл бұрын
Absolutely brilliant tutorial, enjoying working through these alot. Thanks Dan
@discocat9431
@discocat9431 2 жыл бұрын
after 15:52 it doesn't work. In the console says "0". Idk why. Edit: I fixed it. I switched true and false in HasFreeSlot and ContainsItem :d.
@windbox1060
@windbox1060 2 жыл бұрын
Great Job. Thanks.
@DanPos
@DanPos 2 жыл бұрын
Thanks for watching! Part three will be out in an hour or so :)
@windbox1060
@windbox1060 2 жыл бұрын
@@DanPos I will be waiting.
@florianffa
@florianffa 2 жыл бұрын
Thank you so much! Can you do a tutorial on how to pick up the items with a button instead of a trigger? (Raycast probably?) and adding a label onto the item when you look at it at a specific radius?
@DanPos
@DanPos 2 жыл бұрын
This will get you most of the way there kzfaq.info/get/bejne/iq6dipeK1NKon58.html
@darkpalettegames009
@darkpalettegames009 Жыл бұрын
I have a problem ,it is showing oninventoryslotchanged is not declared
@DanPos
@DanPos Жыл бұрын
You've probably not declared oninventoryslotchanged then, or you've spelt it wrong when declaring it
@RileyMacfarlane-cg3or
@RileyMacfarlane-cg3or 7 ай бұрын
Hello I appreciate I am unlikely to get a reply to this but I am having an issue where my player picks up a full stack (of 5) items as opposed to just one and it only seems to work when picking up the first example item created, all others just don't seem to register collision then once the first one is picked up i am able to pickup the other making it a stack of 5 and 1 which is what i want but not how i want to get there
@DanPos
@DanPos 7 ай бұрын
Without seeing your code it's hard to diagnose, but because this is only episode 2, I'd recommend going back to part 1 and start following along again to see what you've missed.
@RileyMacfarlane-cg3or
@RileyMacfarlane-cg3or 7 ай бұрын
@@DanPos I did exactly that and turns out I did follow everything correctly, it seemed to trigger Collison on all items because I had put them all quite close together in the scene. Thanks for the tutorial really helping me appreciating the depth that you explain all the elements looking forward to continuing with this :)
@micaiahstevens8840
@micaiahstevens8840 Жыл бұрын
return freeSlot != null; || return freeSlot == null; Is the same as your checking. You can often simply returns like this. I believe in your case you want the != null;
@Fuzzietomato1
@Fuzzietomato1 Жыл бұрын
did you recently put the repo behind the paywall? Could have sworn I had access last time I was working on this
@DanPos
@DanPos Жыл бұрын
The project files have always been for patrons only
@timurnikolaev1438
@timurnikolaev1438 2 жыл бұрын
incredible code :fire:
@DanPos
@DanPos 2 жыл бұрын
Thanks!
@incrediblecreativity2680
@incrediblecreativity2680 2 жыл бұрын
this is a great tutorial but in mine it is not detecting collision but There is rigidbody and sphere collider component in palyer and items.
@DanPos
@DanPos 2 жыл бұрын
Can you join the Discord and share your code?
@incrediblecreativity2680
@incrediblecreativity2680 2 жыл бұрын
I watched both parts again and debugged and now its working
@incrediblecreativity2680
@incrediblecreativity2680 2 жыл бұрын
​@@DanPos btw thanks for great tutorial​
@DanPos
@DanPos 2 жыл бұрын
@@incrediblecreativity2680 Ah awesome! Glad you got it working :)
@theDarkerSan
@theDarkerSan 2 жыл бұрын
what do you think about adding the "amountToAdd" 1 by 1 in loop? that simplify things a lot. maybe.
@micaiahstevens8840
@micaiahstevens8840 Жыл бұрын
Thats a great idea. I was just debating how to do this.
@theDarkerSan
@theDarkerSan Жыл бұрын
@@micaiahstevens8840 Wow That was 4 monts ago already? anyway, It worked really well for me.
@SamurahGamer
@SamurahGamer 2 жыл бұрын
on line 55 I can't recognize the ItemData
@SamurahGamer
@SamurahGamer 2 жыл бұрын
cool, i already found the error, sorry.
@jasonmurphy2098
@jasonmurphy2098 Жыл бұрын
Don't know if anyone is still around here but does anyone know how to fix when picking up a second of them same item it goes into another slot. So I place a gameobject and dupe it a few times. I walk over the first and that goes into the first slot then I walk over the second and it goes into the second slot and the other ones I walk over go into the first slot. For some reason the second item I pick up goes into second slot and doesn't stack with the rest.
@jasonmurphy2098
@jasonmurphy2098 Жыл бұрын
Issue resolved. I never changed it from the commented out line to the one below it. // return invSlot.Count > 1 ? true : false; return invSlot == null ? false : true;
@JSmithyP
@JSmithyP 2 жыл бұрын
Hey man, great tutorial, it's working amazing. I just need to make some changes such as I only want to allow the item to be in the inventory once. So if you hit a limit of say 10 - you just won't be able to grab the item at all, and it won't go into another free slot, any ideas? Thanks again
@DanPos
@DanPos 2 жыл бұрын
Hey glad you're enjoying it so far! One way of doing this is only getting a free slot if the inventory doesn't contain the item. If it does contain the item you just need to check if there's room in the stack
@JSmithyP
@JSmithyP 2 жыл бұрын
@@DanPos Thanks for the reply, i've been playing around and can't figure it out, i'll keep trying though.
@DanPos
@DanPos 2 жыл бұрын
@@JSmithyP if you join the discord server and post in the inventory tutorial board I'll try to help you tomorrow :)
@JSmithyP
@JSmithyP 2 жыл бұрын
@@DanPos Hey, Cheers Dan - Appreciate it.
@thatfloppafan
@thatfloppafan 2 жыл бұрын
im not sure what happened but im getting an error that says 'Inventory Slot' does not contain a definition for 'ItemData' public bool ContainsItem(InventoryItemData itemToAdd, out List invSlot) { invSlot = InventorySlots.Where(i => i.ItemData == itemToAdd).ToList(); return invSlot.Count > 1 ? true : false; } i put the same thing as the video so i dont know what to do
@DanPos
@DanPos 2 жыл бұрын
Check you have spelt ItemData correctly on the inventory slot class
@thatfloppafan
@thatfloppafan 2 жыл бұрын
@@DanPos oh yeah it was spelled wrong thank you so much for your help
@DanPos
@DanPos 2 жыл бұрын
@@thatfloppafan no worries!
@mariemazaiez6855
@mariemazaiez6855 2 жыл бұрын
please can you help me i got the error CS1001: Identifier expected , in the function UpdateInventorySlot,, there is my code public void UpdateInventorySlot(InventoryItemData data, amount) { itemData = data; stackSize = amount; }
@DanPos
@DanPos 2 жыл бұрын
You need to put int amount, you've just written amount :)
@mariemazaiez6855
@mariemazaiez6855 2 жыл бұрын
@@DanPos thqnk you so much , please if you can help me with another thing, when the player collide with item, each item take an element , with maxstack 1
@Elliotbra
@Elliotbra Жыл бұрын
When The Inventory is full, the gameobject still get destroyed. What should I do?
@DanPos
@DanPos Жыл бұрын
The add to inventory method returns a bool and should only return true if the inventory isn't full, so either that's wrong or your if statement checking the result of the bool is wrong
@Elliotbra
@Elliotbra Жыл бұрын
@@DanPos thanks, it worked. And I have one question to the backpack system; how do I make that if I pick up one specific item, it always goes into a specific slot, no other items can go in that slot. How do I do that?
@JustinDunn_IT
@JustinDunn_IT 2 жыл бұрын
I ran into an issue with the ContainsItem method on Inventory system on my end. invSlot = InventorySlots.Where(i => i.ItemData == itemToAdd).ToList(); throws an error for me (Object reference not set to an instance of an object). I double checked multiple times that the InventorySlots list was being populated with a new slot and a null ItemData / -1 stack size. Only way I could get around it was to wrap that LINQ query in a try / catch and setting invSlot to null in the catch. But you havent done that here so I dont know why it doesnt work. Just wanted to throw that out there for anyone else who might see this issue. I did not have to do the same for the HasFreeSlot method though oddly enough. If you have any insight so that I can remove that try catch I would appreciate it!
@bigt5481
@bigt5481 Жыл бұрын
I ran into this issue as well, my solution was to capitalise the i in ItemData in InventorySlots script and change private to public for the SeralizeField variable. I'm guessing this was my mistake from not following properly so was happy when it fixed it easy enough.
@gigani...4363
@gigani...4363 Жыл бұрын
Everything worked fine until I added the List, since then I got these error messages: "Assets/InventorySystem.cs(39,29): error CS1061: 'List' does not contain a definition for 'AddToStack' and no accessible extension method 'AddToStack' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)" and "Assets/InventorySystem.cs(40,48): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.List' to 'InventorySlot'" I am a Noob in coding and would appreciate if someone could help.
@gigani...4363
@gigani...4363 Жыл бұрын
I think it has something to do with you having references and me not, not to sure though
@DanPos
@DanPos Жыл бұрын
You've either spelt your AddToStack method wrong, or you've forgotten to make it a public method.
@gigani...4363
@gigani...4363 Жыл бұрын
@@DanPos No, double checked that multiple times...
@DanPos
@DanPos Жыл бұрын
@@gigani...4363share your script below
@gigani...4363
@gigani...4363 Жыл бұрын
@@DanPos bruh I did but KZfaq won't let me
ISSEI & yellow girl 💛
00:33
ISSEI / いっせい
Рет қаралды 24 МЛН
Cute kitty gadgets 💛
00:24
TheSoul Music Family
Рет қаралды 15 МЛН
Before VS during the CONCERT 🔥 "Aliby" | Andra Gogan
00:13
Andra Gogan
Рет қаралды 10 МЛН
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 19 МЛН
How Games Have Worked for 30 Years to Do Less Work
23:40
SimonDev
Рет қаралды 1,3 МЛН
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 525 М.
Unity3D - Scriptable Object Inventory System | Part 1
31:31
Coding With Unity
Рет қаралды 327 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,5 МЛН
The BEEFY mini PC - Minisforum AtomMan G7 PT
12:40
ShortCircuit
Рет қаралды 89 М.
Bob Nystrom - Is There More to Game Architecture than ECS?
23:06
Roguelike Celebration
Рет қаралды 199 М.
The Trick I Used to Make Combat Fun! | Devlog
8:12
Game Endeavor
Рет қаралды 1,6 МЛН
An Aseprite Crash Course In 30 Minutes
31:47
AdamCYounis
Рет қаралды 1,1 МЛН
ISSEI & yellow girl 💛
00:33
ISSEI / いっせい
Рет қаралды 24 МЛН