No video

Unity3D - Scriptable Object Inventory System | Part 1

  Рет қаралды 327,580

Coding With Unity

Coding With Unity

Күн бұрын

Пікірлер: 775
@beri4138
@beri4138 4 жыл бұрын
I watched so many tutorials on this subject. The one by Brackeys, Sykoo, Code Monkey, Blackthornprod... This one is by far the best inventory tutorial, and the only one that I fully understood.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
thanks a lot! I really appreciate the kind words :) also im glad you were able to understand it!
@rupeshpandey6603
@rupeshpandey6603 4 жыл бұрын
@@CodingWithUnity Same with me, Their tutorial were not bad but yours were exactly what I needed. Thanks for much for doing this.
@idkidk9204
@idkidk9204 3 жыл бұрын
same :D
@_creare_2742
@_creare_2742 3 жыл бұрын
Same :)
@xkittencatx
@xkittencatx 3 жыл бұрын
Honestly, same here! No hate to the others, but I was able to absorb this tutorial so much better.
@botcomborderreaching3518
@botcomborderreaching3518 8 ай бұрын
For those having trouble initializing the ScriptableObject. I had a problem when I started creating the FoodObject everything was fine but when I clicked the values ​​reset. It was because I used the Awake function. When you click, the object is reset because unity calls the Reset() function. So if you want to fix overwriting values, use Reset() instead of Awake(). This worked for me.
@ImD3VI
@ImD3VI 6 ай бұрын
THANK U SO MUCH 🎉❤ i was struggling for like 20 minutes using OnEnable and everything. This worked amazingly
@user-jf2rj3zf5v
@user-jf2rj3zf5v 3 жыл бұрын
If you've stumbled across this video randomly while trying to find a good tutorial on inventory system in unity, you've found what you need. It's a little complicated at first, and there are a lot of rewriting that will be done in the next videos, but it worth it in a long run and you actually learn something following these videos. So thanks for these videos, i hope you'll be able to make new videos again soon!
@Sam4Progress
@Sam4Progress 6 ай бұрын
Does he eventually address the limitations of enums? Not that I am complaining, this is good information, but the enums is a limitation for creating a dynamic "item" system.
@KekoBit
@KekoBit Ай бұрын
Just make sure you always pick the right names for the fields and never change them again, because renaming a field inside of a SO will cause you to lose all your data. That's one nasty thing they rarely mention about SO. You rename a field, and your data is permanently gone (unless you have a copy, of course). So you need to use the horribly clumsy way with [FormerlySerializedAs] attribute, which is reminiscent of programming in 1970'es. Instead of adding a rename option directly n the inspector.
@Karasu416
@Karasu416 4 жыл бұрын
I went into this extremely pessimistic. There are some very clunky and outdated tutorials on making Inventories and Interaction systems on youtube, but i had to pause this video despite being only 15 minutes in. In these first 15 minutes alone I've learned more than the hours of clunky, messy outdated tutorials i've watched on the topic in the last few days. Thank you so much! Please keep doing what you're doing and making awesome tutorials! I feel by following along I'm actually learning so much more about unity's systems that I didn't know before or how to make use of it better. Thanks a lot! Instant sub!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Thanks alot for the feedback :) Its comments like this that makes the content worth putting out
@AGBWBREH
@AGBWBREH 4 жыл бұрын
You've been freed from tutorial purgatory! Congratulations!
@Voidyn
@Voidyn 4 жыл бұрын
Can you do this in 2D?
@DrFross09
@DrFross09 3 жыл бұрын
I finished the entire series a few weeks ago, and I came back to the first video, where my comment will have the most impact, to say, THIS TUTORIAL IS WORTH EVERY SECOND. My game received a huge upgrade from what I learned in 9 parts. if you've been searching for an inventory tutorial video this is THE ONE. (didn't mean to sound like a TV salesman, but i just got this thing to work with the gamepad, I no longer have to touch the mouse at all, and I'm through the roof right now)
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
That's awesome you got it working with a gamepad! Super cool Also thanks a lot for the kind words
@kdawgfsho04
@kdawgfsho04 3 жыл бұрын
im making a 2d game will this inventory work for me?
@DrFross09
@DrFross09 2 жыл бұрын
@@kdawgfsho04 Yes Of course
@mysteriz_madi
@mysteriz_madi 2 жыл бұрын
You got it to work with a gamepad! Could you maybe tell me how you did it? I'm hoping to make an inventory that way cause I want my game to have a retro, played on an old Playstation, feel with no mouse.
@DrFross09
@DrFross09 2 жыл бұрын
@@mysteriz_madi it’s been a year so I don’t know exactly what I changed to be able to do that however I do remember that I had to copy most of the mouse code and rewrite it for use with the controller. I’m not exactly an expert with coding, so I think you’ll be able to figure it out, but as of now I’d have to looks through the scripts to find out what I changed. I believe the majority of what I changed is in the userInterface script. Start with changing the click to a button press, you’ll need to make another gameObject variable similar to the one that holds the item when selected with the mouse. All I really did was copy all the input functions and refit them so that they can work with a controller. Recently I managed to break something (after it was working for the better part of a year) and the mouse no longer works properly, which is why I’m not sharing the exact code.
@DirtyChance
@DirtyChance 3 жыл бұрын
Just chiming in to say this was the most in depth tutorial I have found on implementing this and it really helped me a ton. I really appreciate getting right to the meat of how to accomplish this, without spending a lot of time talking about useless bits.
@gameboycolor47
@gameboycolor47 3 жыл бұрын
This is hands down one of the best tutorials I've seen on this. Simple straight to the point organized (strangely rare in these Unity tutorials) and from what I've gathered so far extremely flexible. I don't even plan on making an RPG I wanted something for survival horror game and this is perfect.
@vitriolicAmaranth
@vitriolicAmaranth 11 ай бұрын
Thank you for this. As it turns out, what I needed to solve the issue I was stuck on in trying to make an inventory system from scratch myself was constructors, which I somehow didn't encounter or learn about until now. I don't think you really explained what that was in the video and at first I didn't understand it, but I looked up "constructor" in the C# docs and now it makes perfect sense and makes this whole process much, much easier.
@Mr_Wiley
@Mr_Wiley 4 жыл бұрын
I'm half through this and this is the first Unity content creator I feel obligated to Subscribe to. I'm so impressed at your delivery of information. I've done non stop tutorial/lesson surfing the past couple weeks and this one casually covers many of those I've seen with so much ease... and more. Half way, easy subscribe. I'm just hoping when I click your youtube page I see even more content! Big thank you.
@NETRUNNER_03
@NETRUNNER_03 4 жыл бұрын
Brilliant, straight to the point and no nonsense. Thank you so much and keep up the great work dude. I greatly appreciate this video. Liked and subbed!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
thanks a lot!
@SilverHaze5X
@SilverHaze5X 4 жыл бұрын
Ok, this was really a good tutorial. Complete, comprehensive, going strait to the point, and no BS. Solid work!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Much appreciated!
@TheAtticus82
@TheAtticus82 4 ай бұрын
Here 4 years after upload and this tutorial is still amazing. Thank you!
@nv7287
@nv7287 4 жыл бұрын
This is such a great tutorial series/channel, especially that you don't take shortcuts but layer it logically piece by piece, taking the time to explain how it all fits together along with ideas on how it could be extended :) Exciting!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Glad you enjoy it! :D
@boringNW
@boringNW 3 жыл бұрын
Oh my god this is amazing. This is the thing I needed to get over the hurdle that's stopped me so many times before. Thank you!
@subliminalcastillo2126
@subliminalcastillo2126 3 жыл бұрын
I've been looking for a way to make a runescape inventory/banking system and I LEGITIMATELY FIND a tutorial on how to make a runescape inventory/banking system. I have no words to describe how god damn fucking happy this makes me.
@serwetkowywritter1
@serwetkowywritter1 4 жыл бұрын
Amazing tutorial... currently at part 2. It perfectly fits any kind of game you could possibly think of with only minor adjustments. And I like how the code and solutions are constantly changing just as in real-life coding. Thanks to that, it tells a lot about a developer's mindset and teaches different approaches. I was pretty much resigned after watching a few other lazy tutorials and now I'm actually ready to progress with other aspects of my game. 10/10 would (and will) watch again.
@serwetkowywritter1
@serwetkowywritter1 4 жыл бұрын
Oh and now you do have the ads, gz!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Thats awesome to hear!
@Nenepoo
@Nenepoo 3 жыл бұрын
you deserve more views man! this help me so much. After watching Brackeys, i still dont understand the grasp of inventory system but the way you explain it, i understand it right away!
@Sarishie
@Sarishie Жыл бұрын
its been 3 years but it helps me a lot on making inventory, thanks coding with unity, i wish you all the dreams that you had become true, thanks love you
@CodingWithUnity
@CodingWithUnity Жыл бұрын
I wish the same for you. Glad the content has been helpful for you
@LesusGames
@LesusGames 4 жыл бұрын
Not only has this helped me plan out my inventory system, it's helped me solve another little headache I've been having which is how to store images in scriptable objects I need to serialize! Kicking myself I didn't think to just use prefabs... So simple! Thank you!
@FlipYourLearning
@FlipYourLearning 3 жыл бұрын
I'll join the many comments that already praise this video and say that to me this was also one of the best videos at explaining inventories for beginners. Learnt everything I came here hoping to learn and more. And then I found out there are 7 more tutorials on the series covering everything about inventories. Amazing. I'm going to watch them now and will update the comment with my opinion when I finish. Edit: Finished the series. Followed every step and everything worked. I learn A LOT more than I expected about unity and C# features and managed to implement the inventories I wanted in my game. I also did some adaptations and refactored some of the code so that the names made more sense to me. This is a deep tutorial and I had to watch some videos once without writing, then another time following along so that I could get the bigger picture before focusing on the details, but it was worth it. Almost everything gets improved in the next tutorials and many bugs that appear along the way are eventually fixed. The final system is perfectly usable in-game. The creator is charismatic and makes it entertaining to study. Overall, recommended.
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
Hope it helps you
@daryll4645
@daryll4645 3 жыл бұрын
Are you high? It sucks
@FlipYourLearning
@FlipYourLearning 3 жыл бұрын
​@@daryll4645 Well, I'm on the last video of the series and I still think they are great. Maybe not for everyone, but they are exactly what I was looking for. I watched many videos by bigger youtubers but they didn't go into enough depth to allow me to add the features I wanted to add to my game. These ones did, and at the same time, they improved my understanding of unity features such as scriptable objects, abstract and static classes, inheritance, event triggers, and serialization. They have their faults (a lot of refactoring, some confusing names...), but many get fixed later on, and the refactoring part is actually pretty useful for intermediate learners like me. These videos are a glimpse into the mind and workflow of someone more experienced than me and that is valuable. It's hard to become good at coding by watching very rehearsed and edited videos where everything goes right the first time, when so much of actual coding is trying things, getting errors, finding and fixing them, trying again, getting new errors, etc. Also, without that style, these videos might not even exist. I make videos teaching biology and the amount of work it takes to make an entire video is so high it's hard to finish stuff. This iterative process that allows the creator to upload videos even if the entire project is not finished probably allows the videos to exist in the first place. Most importantly: they are free. This kind of depth and length is what you expect from university-level classes or udemy courses, and it is free here on KZfaq. Suddenly finding something like it is worth commenting, as I did.
@K0s1166
@K0s1166 3 жыл бұрын
One of the best tutorials I have seen on youtube. Showing what the end result will be, straight to the point and explained well. Exactly what I was looking for. Earned a sub.
@Micscope
@Micscope 3 жыл бұрын
Best inventory tutorial series on the whole internet right now. Stick with it 'till the end and you'll learn quite a lot about game architecture. Then fiddle with it around a little bit and you can apply these concept to a lot of system, like shop system, skill system, etc.
@DoubleOBond
@DoubleOBond 4 жыл бұрын
This is exactly what I needed to get into developing a game. Thank you for your detailed explanation that is clear yet short and easy to digest.
@yoelmartherus980
@yoelmartherus980 4 жыл бұрын
First inventory system tutorial I watched that actually seems practical. Thanks!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Great to hear!
@kippenegg
@kippenegg 4 жыл бұрын
Much more elegant than my solution would have been and you taught me about ScriptableObjects, great tutorial.
@jimbeanbragger9209
@jimbeanbragger9209 3 жыл бұрын
That tutorial was a rollercoaster ride. Glad I got through it with only a few mistakes and ended up with everything working by the end. Thanks for your hard work c:
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
I'm glad you managed to get it working!! Great work c:
@GaamerGuyys
@GaamerGuyys 2 жыл бұрын
Thank you so much for this tutorial! Every other tutorial I could find was both very complicated and didn't have a very good result. But this it to the point, easy to understand and the result is so worth it!
@CodingWithUnity
@CodingWithUnity 2 жыл бұрын
Glad it helped you!
@mattg1345
@mattg1345 4 жыл бұрын
Please continue this series so many inventory tutorial don't go the distance and never get finishes.
@diegoalejandromartinezespi6672
@diegoalejandromartinezespi6672 2 жыл бұрын
It is surprising how well you explain and from scratch to avoid getting lost.
@JesseTheGameDev
@JesseTheGameDev Жыл бұрын
KZfaq really didn't want me to find this video/series. But I finally stumbled upon it after weeks of looking for a inventory/item system video.
@connormyers322
@connormyers322 4 жыл бұрын
Really helpful, thanks I've learned a lot, I watched code monkey's and implemented his, and I couldn't keep up with all the non-static references, I had to rework the whole thing. Best inventory tutorial I have found!
@HadiExtreme
@HadiExtreme 4 жыл бұрын
Those RS references tho xD Scriptable objects are so powerful, I keep finding new uses for them. Great tutorial!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Glad you like them!
@justmix106
@justmix106 3 жыл бұрын
i love you so much. every other inventory tutorial on youtube is no where near as good as this
@neffthepanda
@neffthepanda Жыл бұрын
Great video! I'm trying to make my own 2D game right now and couldn't figure out the inventory part. This has helped me so much and is way better than any other inventory tutorial I've found on KZfaq before. Everyone else's is so complicated and they do not explain the process as well as you do. Thank you!!!! Will definitely be watching the rest of this series. Even though it is much longer than the rest of similar series, it is worth it 100%.
@jesseweber5601
@jesseweber5601 3 жыл бұрын
I'm only like eight minutes in and I swear to god this is the best unity tutorial on the internet. Not limited to the realm of inventory systems. Just, the best unity guide.
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
we have the same last name :P
@KeithK469
@KeithK469 3 жыл бұрын
Far and away the best inventory tut I have watched. And this is Vid 1!! Thank you for putting this together!
@WegPast
@WegPast 2 жыл бұрын
I like this tutorial a lot, it straight to the point ! Beside that, I have a tip for you all : I've struggle a bit upon the " Destroy(other.gameObject);" because "Destroy" is not immediate and thus, sometimes, my player picked up multiple time the same item before it was actually destroyed. So the simple fix is to add a boolean to your Items.cs script saying either or not it have been picked up or not and test it when picking it up : public void OnTriggerEnter2D(Collider2D collision) { var item = collision.GetComponent(); if (item && !item.haveBeenPickedUp) { inventory.AddItem(item.item, 1); item.haveBeenPickedUp = true; Destroy(collision.gameObject); } }
@isaaccunningham59
@isaaccunningham59 4 жыл бұрын
You deserve more subscribers, this is amazing. I couldn't find anything I understood about an inventory system until I came across this. Thank you so much, you've helped so many people, what your doing is great! Keep it up
@Stratoscaster
@Stratoscaster 6 ай бұрын
Great tutorial, I know I'm late to the party but instead of setting X_START/Y_START, you can set the anchor of the original prefabs & variant prefabs to top-right in the Inspector. Much faster to do, and then when you create additional variants from the original they will inherit the anchoring.
@XienceLab
@XienceLab 4 жыл бұрын
Godot developer here. I've been struggling with creating an Inventory/Item/Equipment system for quite a while now and been desperately looking for tutorials. I finaly gave up searching for Godot specific tutorials and found yours and with just this first part it all finally starts making sense! Unity's ScriptableObjects are basically Godot's Custom Resources so everything is easily translatable to Godot. Thank you very much for your effort, you did a great job!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Thats really awesome! Glad it helped
@RolandOldengarm
@RolandOldengarm 4 жыл бұрын
This tutorial is exactly what I was looking for to create my inventory system. Thank you!
@marularch
@marularch 10 ай бұрын
Thanks for the tutorial, it's very helpful for understanding how to use scriptable objects for various cases. Other people already mentioned using a UI grid for layout instead of manually setting where the inventory slot is displayed. Also, creating a method instead of copy-pasting commonly used code is better practice. I used a new method called AddDisplay() and moved the common lines in that one: private void AddDisplay(InventorySlot inv) { var obj = Instantiate(inv.item.prefab, Vector3.zero, Quaternion.identity, transform); obj.GetComponentInChildren().text = inv.amount.ToString("n0"); itemsDisplayed.Add(inv, obj); } Then you can replace those lines with this function as follows: public void CreateDisplay() { for (int i = 0; i < inventory.Container.Count; i++) { AddDisplay(inventory.Container[i]); } } public void UpdateDisplay() { for (int i = 0; i < inventory.Container.Count; i++) { if (itemsDisplayed.ContainsKey(inventory.Container[i])) { itemsDisplayed[inventory.Container[i]].GetComponentInChildren().text = inventory.Container[i].amount.ToString("n0"); } else { AddDisplay(inventory.Container[i]); } } }
@presidentmariachi4287
@presidentmariachi4287 4 жыл бұрын
First you make bones, then a Monkfish. The RuneScape is strong with this one.
@idkidk9204
@idkidk9204 3 жыл бұрын
XDDD yee
@ariyangrami
@ariyangrami 7 ай бұрын
I love that part in the end you said : this is a pretty " BASIC " way :)))))
@thoringard3811
@thoringard3811 4 жыл бұрын
Cant thank you enough for this video. I have been searching for several days for something to explain how to create an inventory system with scriptable objects and you are the only person who has been able to explain this clearly. This is exactly what I needed! Thanks for this and I hope you continue to make content.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Really appreciate the comment!
@marcelosommerlatte2238
@marcelosommerlatte2238 6 ай бұрын
I was having issues with this and spent an entire day figuring out what was wrong. Perhaps Unity has updated something since the video upload. Unity automatically resets the created object after its creation. To manage this, use the Reset() method instead of Awake() to ensure proper initialization and prevent unintended resets. By doing so, each time you reset this object, it will utilize the default values configured in your script.
@NoodleFoxYT
@NoodleFoxYT 3 ай бұрын
tbanks ;-;
@tidragolol4438
@tidragolol4438 4 жыл бұрын
This series looks great it's worth an Abo :D keep going
@Stratoscaster
@Stratoscaster 6 ай бұрын
For anyone who had issues with the position of the slot images/text, you might want to check out setting the anchor and anchored position instead of using the .position property. The anchored position is relative to the parent component (the inventory screen), instead of the overall position.
@AJMarraffa
@AJMarraffa 2 жыл бұрын
There's a lot of valuable information here, thank you so much! I didn't really understand how inventory systems worked before but it makes a lot more sense now.
@Ultratermin8or
@Ultratermin8or 2 жыл бұрын
By far the best tutorial. First video is better than anything else out there. Can't wait to watch full series
@xkittencatx
@xkittencatx 3 жыл бұрын
So I finished this part of the tutorial. Since I wanted to have my item's icon display inside of my slot, I did a couple things differently. First, I had a slot image that I got from Brackeye's tutorial video, though the image was developed by Sebastian Lague. I made added a smaller image inside of the slot, as well as a textbox so I could display the amount. Then, I prefabbed that and placed is at the prefab gameObject. In my script, I wrote: obj.transform.GetChild(0).transform.GetComponent().sprite = inventory.Container[i].item.item_Icon; //This way, I am getting the child of my slot image, which is the main icon holder. obj.transform.GetChild(1).transform.GetComponent().text = inventory.Container[i].amount.ToString("n0"); //This way, I am getting the text component of the TMP text child.
@liamsnaith6100
@liamsnaith6100 4 жыл бұрын
I have to echo what some others have said and agree that your inventory system video is way easier to follow than some others. I've used this with a grid layout in Unity2D and it works perfectly. Thank you!
@craftalesinc8131
@craftalesinc8131 Жыл бұрын
WOW YOU ARE SO UNDERRATED. Best tutorial that I have seen! It is so well explained. I am a beginner at coding, but you were so clear that I actually felt like I was learning + I was able to add some stuff that made it even better. Thank you so much!
@victorlapin2080
@victorlapin2080 4 жыл бұрын
Instantly saved the whole playlist for future reference. Great stuff.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Awesome, thank you!
@thomasreed2883
@thomasreed2883 4 жыл бұрын
Thanks a ton for this tutorial had to search for several days to find one this good, found most others confusing and counter intuitive without the scriptable objects.
@infernumex
@infernumex 2 жыл бұрын
This is such a solid tutorial. It's a real shame the creator doesn't make videos any more, this channel has a wealth of knowledge.
@CodingWithUnity
@CodingWithUnity 2 жыл бұрын
it is a shame
@infernumex
@infernumex 2 жыл бұрын
@@CodingWithUnity Not to be overly personal, but do you mind if I ask why? Also I hope my comment didn't come across as a slight against you, that was not my intentional all. Just expressing genuine grief that such a talented didact isn't around any more.
@CodingWithUnity
@CodingWithUnity 2 жыл бұрын
@@infernumex Just been bussy at work. The videos may not seem like it but they take a lonnggggggg time to edit, so its been hard trying to figure out how to make the videos and work at the same time. I appreciate the comments tho and do plan on making more videos, just no clue when
@infernumex
@infernumex 2 жыл бұрын
@@CodingWithUnity I completely understand, making videos is a huge amount of work. Hope to see your return at some point!
@DavelTheAwesomenes
@DavelTheAwesomenes 3 жыл бұрын
Oh my god. Watching this and realizing you can do whole lot of systems using this way of game development. Thank you.
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
Your welcome, you can check out the open game project unity is doing also. They use SO for their architecture in a lot of places as well
@bendluhy1312
@bendluhy1312 3 жыл бұрын
Perfect video, i had no idea where to start with an inventory. This not only helped with me getting started but also helped so I can expand and customize this on my own.
@metaDeWeta
@metaDeWeta 3 жыл бұрын
This is absolutely fantastic, love the whole series. You are a true hero, thanks a thousand million
@infiniteai9768
@infiniteai9768 4 жыл бұрын
Can't believe how much this video accomplishes in 30 minutes. Thank you.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Glad it was helpful!
@simoxeh
@simoxeh 2 жыл бұрын
Great info but definitely taught at a speed that he understands and a lot of different info at once. Definitely good information and I'll likely have to watch a few times to get everything if I don't want to just copy and paste his code and actually understand why he does things
@dantetoomaycry
@dantetoomaycry 3 жыл бұрын
I missed a few things here, so I had to combine some tutorials into one, but this one is by far the best and I used it as a learning base. But I have a note about the UpdateDisplay function. It shouldn't be in the update. It should only be called when picking up the item. Maybe it will be changed in next episodes, but I prefer to write it now.
@Wayloz
@Wayloz 2 жыл бұрын
Not a bad idea though you'll have to remember to add it to your dropitem, useitem, and exchanging when shopping/selling to vendors. Though it's less performant, for tutorial sake this way covers all of the above. I believe I ended up putting mine into a coroutine for now.
@ashfid8987
@ashfid8987 5 жыл бұрын
Okay, I didn’t know you will post this early. I am so happy! Thanks for this!
@CodingWithUnity
@CodingWithUnity 5 жыл бұрын
No problem! Hope you like it
@ashfid8987
@ashfid8987 5 жыл бұрын
Coding With Unity Definitely. I know theres few issues on serializing scriptable object for inventory system that have gameObjects. Will you be focusing on saving system down the line? Love the fact you enjoy Runescape.
@CodingWithUnity
@CodingWithUnity 5 жыл бұрын
Yes ill make a video specifically showing how to serialize, save and load the scriptable objects
@ashfid8987
@ashfid8987 5 жыл бұрын
Coding With Unity Best youtuber right now. No bullshit haha ❤️
@MuftahDev
@MuftahDev 2 жыл бұрын
that's the best tutorial for implementing this system, but I had to use Grid layout group instead of doing it manually and it worked just fine, keep it up
@Xerisis
@Xerisis Жыл бұрын
Just as a side note, instead of setting the location of the InventorySlot items, you can just use a GridLayout on the parent to configure where they are located. Just make the object with the GridLayout the parent of the InventorySlot item: var obj = Instantiate(slotPrefab, gridViewObject.transform, false);
@lando6583
@lando6583 4 жыл бұрын
This a very clear, precise, and intuitive implementation of scriptable objects! Thank you
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
no problem! Thank you as well!
@smallferalgirl
@smallferalgirl Жыл бұрын
lmk if this is addressed later in the series I havent seen them all but at 17:00 -ish picking up items is implemented by walking over stuff, but if you wanna do it with e while looking at smth its good to use raycasting, like this code I modified in this lovely video kzfaq.info/get/bejne/aK-YrbOFuJrFpmg.html [SerializeField] private Transform playerCameraTransform; [SerializeField] private Transform objectGrabPointTransform; [SerializeField] private LayerMask pickUpLayerMask; public InventoryObj inventory; private void Update() { if (Input.GetKeyDown(KeyCode.E)) { float pickUpDistance = 2f; if (Physics.Raycast(playerCameraTransform.position, playerCameraTransform.forward, out RaycastHit raycastHit, pickUpDistance, pickUpLayerMask)) { Debug.Log(raycastHit.transform); var item = raycastHit.collider.gameObject.GetComponent(); if (item) { inventory.AddItem(item.item, 1); Destroy(raycastHit.collider.gameObject); } } } }
@user-uv6pj6lq4x
@user-uv6pj6lq4x 11 ай бұрын
Thank you! OnTriggerEnter method was giving out errors, but this worked
@HappyBell92
@HappyBell92 Жыл бұрын
This tutorial was awesome, I learned a lot watching this. This is precisely the inventory system I wanted for my side project game.
@soup8249
@soup8249 Жыл бұрын
ive been trying to learn unity all weekend (i started on friday) and ive looked through quite alot of videos and stuff, and this is really top tier man! I love how your explaining what were doing and why so im actually learning and not just copying your answers lol
@jeffreydiggs9216
@jeffreydiggs9216 3 жыл бұрын
The cooking game I'm trying to make as my 2nd game ever was already turning into a gigantic mess and I was this close to give up, until I watched your video. THANK YOU SIR !!
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
Im glad I helped make your project a bit easier
@chris.davidoff
@chris.davidoff 4 жыл бұрын
I love this! It's exactly what I was hoping to find. I was wondering why you made the "DisplayInventory" script instead of using the "Grid Layout" component that is available?
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
didnt think about the grid layout component when i made it :)
@ignallacay
@ignallacay 2 жыл бұрын
For those wanting to use this approach, this is the DisplayInventory code: public class DisplayInventory : MonoBehaviour { public InventoryObject inventory; Dictionary itemsDisplayed = new Dictionary(); private void Start() { CreateDisplay(); } private void Update() { UpdateDisplay(); } private void CreateDisplay() { for (int i = 0; i < inventory.Container.Count; i++) { var obj = Instantiate(inventory.Container[i].item.prefab, Vector3.zero, Quaternion.identity, transform); obj.GetComponentInChildren().text = inventory.Container[i].amount.ToString("n0"); itemsDisplayed.Add(inventory.Container[i], obj); } } public void UpdateDisplay() { for (int i = 0; i < inventory.Container.Count; i++) { if (itemsDisplayed.ContainsKey(inventory.Container[i])) { itemsDisplayed[inventory.Container[i]].GetComponentInChildren().text = inventory.Container[i].amount.ToString("n0"); } else { CreateDisplay(); } } } Remember to add the grid layout component in the InventoryScreen!
@renzbolado153
@renzbolado153 2 жыл бұрын
@@ignallacay I'm confused by Grid Layout, is that a script CWU made in a different video? or something inherent to Unity? ive got no errors but there are no sliders applicable to the script once ive applied it to the InventoryScreen
@ignallacay
@ignallacay 2 жыл бұрын
@@renzbolado153 Hey Renz, I just get to see the message, hope I got it on time. Grid Layout is a unity built in component. You'll find it easily by writing Grid Layout when adding a new component in the inspector. It will auto-arrange the child objects in the parent object with the Grid Layout component. You'll find the spacing, etc. variables in that component too. I also have a notification with another message about an error at the end of the code, but I'm not able to see the message, not sure if you deleted it
@cannotfigureoutaname
@cannotfigureoutaname 2 жыл бұрын
@@ignallacay does the grid layout component version work with drag and drop?
@nicholasleach8770
@nicholasleach8770 4 жыл бұрын
Finally, an inventory system tutorial for programmers. Thank you!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Enjoy!
@plasmarade
@plasmarade 4 жыл бұрын
You are very dedicated
@viridienne9289
@viridienne9289 2 жыл бұрын
Hi, I'm new to your channel. I'm just as same as some people here, I have watched many tutorials about inventory system from Brackeys, Code Monkey ..etc... I'm not new to Unity, but I still cannot fully understand their logic and code. Yours is the most understandable I have met so far. Thank you for your neat explanation, although the grid layout can make the display code cleaner. You have my subscription.
@kau3239
@kau3239 4 жыл бұрын
Dude great stuff, the other tutorials out there weren't as concise and well put together as yours.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
Glad you like it!
@greghaas4433
@greghaas4433 2 жыл бұрын
Phenomenal tutorial. optimal pacing and explanation for beginners. Thank you!
@therendeath4886
@therendeath4886 2 жыл бұрын
Absolutely amazing, and a entire playlist?! even better
@yahoruz
@yahoruz 4 жыл бұрын
getting this setup with my already existing ui might be annoying but the extensibility logic is so dope i really have no choice really amazing tutorial
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
You can for the most part strip the UI part out and remake that part and just use the backend Inventory logic, wouldn't be that much work because I'm only feeding info into the UI for the most part. (would have to figure out swapping items tho)
@yahoruz
@yahoruz 4 жыл бұрын
@@CodingWithUnity yea i think its easier when you go to the slot based system later so this should be decently easy to implement into mine. thanks again for these video buddy
@dinendash1166
@dinendash1166 3 жыл бұрын
I just finished This tutorial and it works exactly like it should. thanks for the info.
@CodingWithUnity
@CodingWithUnity 3 жыл бұрын
You're welcome!
@olieolieolieolie1249
@olieolieolieolie1249 3 жыл бұрын
excellent intro to inventory systems… i like the clearness …i am writing my own and this has pointed me to a better workflow. many thx
@crazybobby14
@crazybobby14 2 жыл бұрын
This is the best so far in inventory system. On point and well explained on what each part does. One thing I thought about the inventory part that you showed, was that you could use it like chests or extra bags that you can equip like in Don't Starve. In this video I could understand and expand easily on, where on Code Monkey skips many parts and fast forwards too much where you end up spamming . and , to comprehend whats going on. Plus I hate writing something and then he erases it a few minutes later and writes new stuff like come on... I don't hate his tutorials, is just that those two things gets too irritating after a while.
@mtlpgaming
@mtlpgaming 2 жыл бұрын
A F*cking Legendary Tutorial, you did in 5 minutes what Sykoo couldn't achieve in an Hour...
@Rioni
@Rioni 4 жыл бұрын
Awesome tutorial, I've never thought using scriptable objects this way. I'll watch it again tomorrow because there is a lot of content here to learn
@AwataraGame
@AwataraGame 2 жыл бұрын
This tutorials really help me, I have developed and use your tutorials and apply this to all of my elements!
@JigJason93
@JigJason93 5 жыл бұрын
This is a brilliant tutorial and helps me alot, thank you sir
@LaurenceCreates
@LaurenceCreates 5 жыл бұрын
I have used scriptable objects before but i have never really thought about using it in a multiplayer game. so this video has given me plenty of ideas. thanks mate :D
@davidmartin4553
@davidmartin4553 Жыл бұрын
For anyone else having an issue where items occasionally duplicate when being added to the inventory at 18:30, I just added "other.gameObject.SetActive(false);" in the player script right before "Destroy(other.gameObject);" Based on the two seconds of research I did, the destroy method is queued up for the end of the frame and then ran asynchronously which means that object may possibly persist by the time the next frame is runs so you end up triggering the collider more than once. Also, idk if this is the best solution but it works for me.
@TiffanyGilley
@TiffanyGilley 2 жыл бұрын
Big thanks for making this. It taught me enough to make my own unique inventory system!
@CodingWithUnity
@CodingWithUnity 2 жыл бұрын
That's wonderful to hear!
@krazywulf1983
@krazywulf1983 3 жыл бұрын
love this video im so glad i found it.. its exactly what i wanted i just dident know how to put it into code.. thank you mate for the help in my game.. spent a week talking to wife trying to figure out the code then i found this video and it came together perfectly
@darrenj.griffiths9507
@darrenj.griffiths9507 3 жыл бұрын
Thank you for the video. Really straight forward to follow and understand. And being British, gotta' love that accent. The way you say bones hahaha
@teamcw5204
@teamcw5204 3 жыл бұрын
This is a great lesson! Really easy to follow, which makes the concepts easier to learn. I was stuck on this, and now I can't wait to move forward. You definitely earned a sub from me! Cheers!
@qiangpanchen6785
@qiangpanchen6785 2 жыл бұрын
a great tutorial about scriptable objects and invevntory basic structrue , thank you so much!
@rcjvet
@rcjvet 4 жыл бұрын
No slam on the instructor, but for those new to or learning C#, the correct term is "method" not "function" as in the video. Function is a term more generally used for reusable code blocks outside of a class. Whereas methods are contained within a class and ultimately establish the purpose of the class. Great video though, probably the best I have seen for setting up a simple inventory. I am looking forward to the entire series.
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
I make this mistake quite often and is great to point out!
@joannag8326
@joannag8326 3 жыл бұрын
It starts super complicated but I can see it making entire game creation whole lot easier.
@exon878
@exon878 3 жыл бұрын
Love the vid. Goes deeply into the code and showed me and my friend new ways of coding and this will fit perfectly in our new game and we well have great use of this in the future. Earned yaself a sub.
@DrummyMcDrumface
@DrummyMcDrumface 4 жыл бұрын
I can't believe this doesn't have more views. Much more optimized than the leading videos and the pacing is near perfect, was very easy to follow along with. Excellent work man. Would love to see a base building tutorial if possible. Similar to Ark or Conan exiles?
@DrummyMcDrumface
@DrummyMcDrumface 4 жыл бұрын
subscribed, and put the bell on!
@CodingWithUnity
@CodingWithUnity 4 жыл бұрын
thanks a lot! And a base building series would be cool to do, but no promises on if i will be able too
@dongo6988
@dongo6988 2 жыл бұрын
7:01 lmfaoo it’s own unique name, unique description, etc.
@fred1541
@fred1541 5 ай бұрын
That's good~ I have been searching for the way how to make my game more flexible while managing so many items in one character
@theosdores4111
@theosdores4111 5 жыл бұрын
nice video, watched it cuz of curiosity :) idea - you could shorten the function at 13:22 - you don't really have to use bool hasItem - you could just return from that for loop instead of breaking, that would not execute that Container.Add() function after it.... if you haven't returned from for loop (which will also end function), everything after it will be executed. IDK maybe it's dumb if you wanna improve that function later, just an idea :D
@CodingWithUnity
@CodingWithUnity 5 жыл бұрын
Awesome! Glad it caught your curiosity! Also thats a great idea! Ill most likely do that!
@theosdores4111
@theosdores4111 5 жыл бұрын
@@CodingWithUnity yo I always like to find ways for making the code as short and quick as possible, that helps out with readibility later on a bit :D
@dyshili
@dyshili 4 жыл бұрын
Great tutorial! one thing that could have been done easier is having unitys grid layout group do the item icon positioning rather than coding it from scratch.
@rosssyy9684
@rosssyy9684 3 жыл бұрын
at 3:55 I have public class DefaultObject : ItemObject but I get an error saying "Assets\Scriptable Objects\Items\Scripts\DefaultObject.cs(9,25): error CS1001: Identifier expected" can somebody help?
Be CAREFUL with Scriptable Objects!
8:27
Code Monkey
Рет қаралды 79 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 16 МЛН
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 12 МЛН
The Power of Scriptable Objects as Middle-Men
17:41
samyam
Рет қаралды 123 М.
Someone Made Pay 2 Win: The Game And Its Hilarious
14:11
MitchManix
Рет қаралды 3,1 МЛН
Scriptable Objects: What are they? How do you use them?
10:38
Unity ScriptableObject. Пишем простой инвентарь
6:08
Insane One - Разработка игр
Рет қаралды 46 М.
How do non-euclidean games work? | Bitwise
14:19
DigiDigger
Рет қаралды 2,4 МЛН
An Aseprite Crash Course In 30 Minutes
31:47
AdamCYounis
Рет қаралды 1,1 МЛН
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 178 М.
Creating An Inventory System in Unity
11:03
Game Dev Guide
Рет қаралды 178 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 16 МЛН