Unity Inventory System - Easy Tutorial

  Рет қаралды 199,476

Solo Game Dev

Solo Game Dev

Күн бұрын

Inventory system is used in most of the games. If you need an inventory system in your game, this video is for you. In this video, I will teach you how to make an inventory system from scratch. Enjoy watching.
❤️Join My Channel to Support Me: / sologamedev
💙Subscribe to My Channel: www.youtube.com...
●For How to Make a Multiplayer Game in Unity | Easy Tutorial: • How To Make A Multipla...
●For Unity Multi-Language System(Localization): • Unity Multi-Language S...
●For How To Make an AR Application in Unity : • How To Make an AR Appl...
Hi from Solo Game Dev. I am a game developer. On this channel, I create easy to learn game development tutorials and develop games with Unity and the other game engines. These tutorials and games also include multiplayer games. In general, I create content related to game development, game design and games.
I also actively respond to comments and feedback so don't be afraid to let me know what you think, or recommend or request a specific video!
Follow and enjoy unique content!
You can follow me on Social Media and send your questions and requests from there!
TWITTER: / sologame_dev
INSTAGRAM: / solo.game.dev
#UnityInventorySystem

Пікірлер: 510
@icresoftgames
@icresoftgames 2 жыл бұрын
For beginners using this tutorial, take note of the enum itemtype section of this video. That will help you interact with your custom button for each item. E.G Use, Combine, Discard buttons. This is a great tutorial by the way
@atifassdi398
@atifassdi398 11 ай бұрын
can you do the inventory like a package and send it for me pleas because i hane problem
@suzypayne2333
@suzypayne2333 Жыл бұрын
At 9:03 if Unity can't find the text component for itemName, try changing to . Thanks for the tutorial! :)
@canyouknot4536
@canyouknot4536 11 ай бұрын
what about if for the image?
@thelongminecart7393
@thelongminecart7393 11 ай бұрын
Thank you so much I spent ages wondering what I did wrong you are the reason I didn't scrap my game thank you so much
@suzypayne2333
@suzypayne2333 11 ай бұрын
@@thelongminecart7393 I'm so glad! Good luck with your game! :))
@Clicks_And_Flicks
@Clicks_And_Flicks 10 ай бұрын
it helped me Thankyou
@aanuutaa
@aanuutaa 7 ай бұрын
thankyou so much!!
@orio69
@orio69 Жыл бұрын
If anyone is having an issue where the use item doesn't work on second time we open the inventory, it is because the inventory item controller array in item manager adds repeated item objects which was supposed to be cleaned via the clean content loop. Solution: Move the clean content loop onto its separate method Add this method to onclick event of close button of whole inventory. Make sure you REMOVE clean content loop from ListItems method. And you will be good to go.
@normalguy845
@normalguy845 Жыл бұрын
Can u give script? XD
@normalguy845
@normalguy845 Жыл бұрын
Or even give me some contact to you it's very important to me
@orio69
@orio69 Жыл бұрын
@@normalguy845 if you follow the steps that I've given you in solution, you should be good to go, given that you have followed this video tutorial till the end.
@marianmarian8882
@marianmarian8882 Жыл бұрын
Thanks man nice job for those who dont know what to do just cut the destroy code above instantiate on list items and paste on a function that close the inventory
@orio69
@orio69 Жыл бұрын
@@marianmarian8882 Glad i could help
@barankavlak
@barankavlak Жыл бұрын
Temiz anlatım için teşekkür ederim. Daha ilk 5 saniyede dedim bu bizim ingilizce aksanı nerede görsem tanırım dedim :D. Eline sağlık tekrardan
@chritsfootballs
@chritsfootballs Жыл бұрын
For those having issues with duplication in item controller array. Take the logic that cleans the list from list items and make it it’s own method. Then call cleanlist method when you close your inventory
@markvincenttamayo151
@markvincenttamayo151 Жыл бұрын
thankyou so much! I am struggling so much with this problem. Thankyou!
@niventine
@niventine Жыл бұрын
God bless you and all your family! been struggling for a couple of hours on this one
@chritsfootballs
@chritsfootballs Жыл бұрын
@@niventine all good dude, it definitely takes some work arounds
@scoopish2880
@scoopish2880 Жыл бұрын
THANK YOU! THANK YOU!!!!! THANK YOU!!!!!! I KNEEL BENEATH YOUR FEET!!!! THANK YOU SO MUCH!!!!!
@scoopish2880
@scoopish2880 Жыл бұрын
oh and this was a bit unclear but you also gotta keep the original logic that cleans the list where it is. just make another function, dont erase the first one.
@kasekuchentv7869
@kasekuchentv7869 2 ай бұрын
This tutorial is great for people who have experience in programming, but not with unity. Well done!
@baphometfromabove
@baphometfromabove 11 ай бұрын
Hello, I have tried to implement an inventory system to my game which is highly inspired by your code and I have noticed something. When dealing with more complex scenarios like opening multiple inventories from different objects ,like chest panel from a chest, the item list gives some error while removing or sometimes in altering. The thing is I think your code is little casual friendly so you didn't go through all sorts of scenarios. For anyone who are getting error while removing an item from a list or processes like that, you have to write a safe code for changing the list. Thing I come up with is to make a copy of Items list and removing item in that copy. After you have done, assign the copy to your Items list. It somewhat like this: public void Remove(Item item) { List newItems = Items; newItems.Remove(item); Items = newItems; } Hope you a good day...
@ariatari2137
@ariatari2137 12 күн бұрын
not working
@baphometfromabove
@baphometfromabove 12 күн бұрын
@@ariatari2137 It should tho! If you are able to share your code we can check it. There are many ways to remove an element. I dont't exactly remember what I did here but it looks like I was solving the collection manupilation. While working with professionals, we have to write as clean as possible so I recommend you to try another approach. Like marking the elements dirty then remove it. I hope it helps. Cheers... Edit: Grammar
@ariatari2137
@ariatari2137 7 күн бұрын
@@baphometfromabove So my problem is exacly when i pickup items and open my inventory i can normally drop and use them and everything is fine. The problem is when i close and reopen inventory again it looks normal but my InventoryManager object (with the same name script) has now X missing elements in inventoryItems array, where X is the number of items you had prevoisly. So for example i pickup 2 items, then close and reopen inventory and now i have 4 array elements: 2 items and 2 "Missing (Inventory Item Controller)". I hope you get it that way. Everyone told me that i have to "clean my inventory list (not array) before opening or after closing it" which i dont know how to do public class InventoryManager : MonoBehaviour { public static InventoryManager Instance; public List items = new List(); public Transform itemContent; public GameObject inventoryItem; public InventoryItemController[] InventoryItems; private void Awake() { Instance = this; } public void Add(Item item) { items.Add(item); } public void Remove(Item item) //Keep in mind this method is written by you and i just copied it { List newItems = items; newItems.Remove(item); items = newItems; } public void ListItems() { //Clean content before open. foreach (Transform item in itemContent) { Destroy(item.gameObject); } foreach (var item in items) { GameObject obj = Instantiate(inventoryItem, itemContent); var itemName = obj.transform.Find("ItemName").GetComponent(); var itemIcon = obj.transform.Find("ItemImage").GetComponent(); itemName.text = item.itemName; itemIcon.sprite = item.sprite; } SetInventoryItems(); } public void SetInventoryItems() { InventoryItems = itemContent.GetComponentsInChildren(); for (int i = 0; i < items.Count; i++) { InventoryItems[i].AddItem(items[i]); } }
@baphometfromabove
@baphometfromabove 7 күн бұрын
@@ariatari2137 You just have to call "InventoryItems = null; "or "new InventoryItemController[0];" before populating, closing or opening, whichever you like. public void ListItems() { foreach (Transform item in itemContent) { Destroy(item.gameObject); } //something like this InventoryItems = new InventoryItemController[0]; //rest of the code }
@fourbricio_ttg5194
@fourbricio_ttg5194 Ай бұрын
Esse foi o inventário mais descente que encontrei até agora, segui a página e tudo mas infelizmente travei no min 09:00. Perdi algumas horas até ler os comentários e ver que fui o único. Vi outros vídeos também e infelizmente não tem mais conteúdo, como a sequência do RPG, eu vi um inventário nele mas não tem continuação. Faz mais vídeo irmão o conteúdo é da hora.🎉
@TheSharkship
@TheSharkship 2 жыл бұрын
Thanks for the tutorial, this helped me so much but I have a question, how would I save the inventory between scenes and make it so that if the scene was reset the inventory would be the same as it was the first time that scene was loaded
@ukieiri6685
@ukieiri6685 2 жыл бұрын
Plus to this
@bonxd
@bonxd Жыл бұрын
Player prefs?
@foreverblessed3511
@foreverblessed3511 Жыл бұрын
Without having watched the video properly, I reckon you will have to have a game object, with a list and have a script that populates the list upon scene completion, from the list in the inventory. Then when you head into the next scene you repopulate inventory list from the list of the game object from previous scene. This is vague and there might be a easier solution but I'm trying to think how this would work (still a noob too :))))
@javipamp
@javipamp Жыл бұрын
It would be great to know how to do that and save it for next game or level.
@TheJakeblake
@TheJakeblake 11 ай бұрын
You would need to serialize the grid in a local database, so the info of the inventory does not gets deleted once you stop playing the game. There is a nice tutorial of Coding with Unity that does that.
@Martin.Jorgensen
@Martin.Jorgensen Жыл бұрын
If anyone are getting errors from this line: itemName.text = item.itemName; It might be that you have used: var itemName = obj.transform.Find("ItemName").GetComponent(); instead of: var itemName = obj.transform.Find("ItemName").GetComponent(); The button might use the component TextMeshPro instead of the older Text variant. In any case, hope this might help.
@heal4386
@heal4386 Жыл бұрын
You are a real life saver man, i have been trying to figure out the problem for days.
@keaneborg1764
@keaneborg1764 Жыл бұрын
Actual hero, thank you!
@JihyoTheGod
@JihyoTheGod Жыл бұрын
Thank you so much for that, seriously!
@Thecursedshadows
@Thecursedshadows Жыл бұрын
thx mate you really solved my problem... now I have no errors in console but still when I open inventory still nothing new happens weird
@EngPhillipeSedycias
@EngPhillipeSedycias Жыл бұрын
Thank you, it worked for me.
@장토끼-c9t
@장토끼-c9t Жыл бұрын
[I use a translator because I can't speak English] If I press the inventory button to turn it off and then back on, the item inside is not available. What is the solution to this problem? error : NullReferenceException: Object reference not set to an instance of an object
@adamlloyd2009
@adamlloyd2009 2 жыл бұрын
If anyone still have problem with the items not showing inside the inventory after pickup, change the itemName line to: var itemName = obj.transform.Find("ItemName").GetComponent(); Worked for me!
@grimaldiemiliano
@grimaldiemiliano 2 жыл бұрын
Thank you, this worked for me!!!
@afutik
@afutik 2 жыл бұрын
Thanks
@gabrielklark3357
@gabrielklark3357 2 жыл бұрын
I suffered a lot before realizing I was using TMPro
@ODmn25
@ODmn25 4 ай бұрын
For some reason I'm getting the same issue with the Image
@cheesecake906
@cheesecake906 4 ай бұрын
Wait what about the itemIcon? It dosent reconise it and Dosent work
@shadow.7842
@shadow.7842 2 жыл бұрын
Thanks so much! I've been trying to find some like this but they were all either not what I wanted or WAAAY to long and boring.
@smokinglife8980
@smokinglife8980 2 жыл бұрын
Thats what happens when you code just wait till theres something you want to add that there is no tutorial too you will just have to sit down and trial and erroe it over and over till you get something that works / you like
@kiwouine4969
@kiwouine4969 Жыл бұрын
9:23 It does not work for me.When I take the object then I open the inventory there is still no image and the error says: Get component requires that the requested component'image'derives from MonoBehaviour or Component or is an instance. An idea ?
@Marius-pp9pe
@Marius-pp9pe 2 жыл бұрын
Hello, what you are doing on 5:23, dragging the item to item Controller scripts doesnt work for me? Any idea why?
@Glori4n
@Glori4n 2 жыл бұрын
Hello SoloGameDev! This was by far one of the easiest and most comprehensive inventory tutorials out there, top notch content. Your accent made it a little difficult to understand in some parts but it was very minimal. Thanks for the effort put into this. Best regards!
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Thanks :) I'm trying to improve my accent.
@guillermoadrianricci136
@guillermoadrianricci136 2 жыл бұрын
who has been blind their whole life and can finally see. I can't express my gratitude in words but tNice tutorials is the best I can do. THANK YOU SO
@hazen7645
@hazen7645 Жыл бұрын
Wow, this is super cool man. Pretty flexible and easy to expand on. 💯
@alexsalontai6365
@alexsalontai6365 2 жыл бұрын
Hey, thank you for the tutorial! I was wondering if there was a way for items to be moved and organized in different slots. Do you also know how to drag the item out of the inventory to be placed down like a prefab?
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Yes but it's a bit complicated. But i will do a tutorial for this soon :)
@FadiFlashi
@FadiFlashi Жыл бұрын
I'm very confused. my scripts are exactly like his, and I do have a mesh collider (followed all the steps), but whenever I run my game, nothing happens when I click them. Any idea why it can be? O_O
@RL_Kaizen
@RL_Kaizen Жыл бұрын
did u fixed it? I have the same issue
@FadiFlashi
@FadiFlashi Жыл бұрын
@@RL_Kaizen I didn't fix it.. I ended up writing my own inventory system from scratch 😅 Sorry! Hope you'll be able to find a solution!
@samvandergast4410
@samvandergast4410 28 күн бұрын
@@FadiFlashi would you be able to link your system? this tutorial just isnt working out for me 😅
@pluacherry5378
@pluacherry5378 2 жыл бұрын
Thanks for the great turtorial, honestly this was on point and clear all the way, rarely do I see a tutorial as easy to follow as this. just one question as I am trying to creat a counter for multiple items of the same type how would you advice me to start on?
@SoloGameDev
@SoloGameDev 2 жыл бұрын
You can add quantity text in Prefab. Then, before clicking on the items, if there is the same item in the list of added items, you can only increase the number.
@pluacherry5378
@pluacherry5378 2 жыл бұрын
@@SoloGameDev Thanks!! that actually did did exactly what I needed
@SoloGameDev
@SoloGameDev 2 жыл бұрын
@@pluacherry5378 You're welcome :)
@ariatari2137
@ariatari2137 12 күн бұрын
how to clean inventory before opening i mean items.Clear(); works but only for one item when i have multiple items in my inventory and then close and reopen inventory they got duplicated, either cleaning this way will remove/clean the second item or just all other items
@retlyfast4816
@retlyfast4816 2 жыл бұрын
great video man you just save my day i had been working inventory system for month lol
@EXP256
@EXP256 2 жыл бұрын
is it good for a first person shooter?
@hawkzheng8871
@hawkzheng8871 2 жыл бұрын
I am still a little confused about the meaning of the InventoryItemController script, what exactly does the array variable InventoryItemController[] in InvetoryManager do? It also occurs with some bugs in which when I close the inventory and reopen it, the InventoryItemController[] will double the size inside the InvetoryManager, the item inside the box disappears after I click the remove button however the item when will appear again when I close and reopen the inventory, any ideas? Thank you
@MUT-Studios
@MUT-Studios Жыл бұрын
ya this happened with me too
@arandomcookie
@arandomcookie Жыл бұрын
Howdy folks. If your InventoryManager script isn't working, it's not your fault. Mr. Dev sliced the footage and cut off the part where he adds the Using UnityEngine.UI line. Still think that's too ridiculous of a claim? Check the line numbers in the corner change at 8:10. Honestly dude, this is BEYOND foul play, it's just evil. You can't do this crap in tutorials. I know Mr. Dev didn't do it maliciously, but this is not something that just slips through the radar of an editor. COME ON!!! Edit: People don't watch tutorials for entertainment. We watch them to learn and create. Sure, editing the video to achieve a reasonable pace is good, even commendable. But slicing out a crucial piece of code and covering it up by placing the screen in the same place is depriving people CRUCIAL INFORMATION. This is beyond un-ethical. This CANNOT happen in a tutorial, else no-one can trust anything they see in your videos, @SoloGameDev. For the love of Python, do NOT make this mistake again. This actually got me furious. Edit 2: Did it again at 11:22. COME ON
@cong5805
@cong5805 5 ай бұрын
appriciate this rant, i couldn't figure out why i was getting an error
@cheesecake906
@cheesecake906 4 ай бұрын
Wow, thank you I was really struggling
@magnusgrohmann4746
@magnusgrohmann4746 2 ай бұрын
thanks
@Ozertaye
@Ozertaye Ай бұрын
Thank you
@ariatari2137
@ariatari2137 19 күн бұрын
thanks
@abhishektiwari7200
@abhishektiwari7200 Жыл бұрын
Sir I have a issue of the items are deleting from viewport but not from the list the item in inventory item controller is saying the null reference of item
@Jon2mil
@Jon2mil Жыл бұрын
Did you fix this?
@tendenciasmediodigital9235
@tendenciasmediodigital9235 2 жыл бұрын
TNice tutorials was really helpful for soone coming from Ableton Live and having used Fruity Loops waaaay back in the past
@AbhayTheSG
@AbhayTheSG 3 ай бұрын
I'm getting an error saying "NullReferenceException: Object reference not set to an instance of an object" in line 25. I tried changing to and but none of them seem to work.
@AbhayTheSG
@AbhayTheSG 3 ай бұрын
FOUND IT - Add this line to your script - using TMPro; Then change the child class names to "ItemName" and "ItemIcon" respectively Then change lines 25 and 26 to this: var itemName = obj.transform.Find("ItemName").GetComponent(); var itemIcon = obj.transform.Find("ItemIcon").GetComponent(); This worked for me
@dnaseb9214
@dnaseb9214 Жыл бұрын
You NEED to say where those variables are coming from. For example "itemName" in InventoryManager script. No idea where it is from. If not this guide is useless.
@disuko
@disuko Жыл бұрын
Is there a way to make the inventory refresh automatically when the player picks up an item, so that they don't have to close and reopen it to see items if they pick them up while it is open?
@ramangurah6091
@ramangurah6091 Жыл бұрын
Hi! you can replace the void Pickup() in ItemPickup script like this void Pickup() { InventoryManager.Instance.Add(Item); InventoryManager.Instance.ListItems(); Destroy(gameObject); }
@Uploader.mp4
@Uploader.mp4 2 жыл бұрын
I need help because with no reason it aspears me an error that doesn’t have sense: in the inventory manager script it appears me 2 errors: error CS0246: the type or namespace name ‘Text’ could not be found (are you missing a using directive or an assembly reference?), and aswell with the ‘Image’ please could you help me?
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Can you send me your code's screenshots to my mail?
@UberJanusz
@UberJanusz 2 жыл бұрын
Had the same issue, if anyone else is wondering how to fix this : you need to add using UnityEngine.UI; line
@Blurzzyface
@Blurzzyface 2 жыл бұрын
@@UberJanusz THANK YOU!!!!
@karimgobara1475
@karimgobara1475 Ай бұрын
I have a problem when i press the button it does'nt give me the type of the item;
@btvbharat2154
@btvbharat2154 2 жыл бұрын
damn calling out right now. Hey, when you're passionate about sotNice tutorialng it makes you actually want to study it!
@Dani17
@Dani17 Жыл бұрын
hey, i've been using this system recently and I found a bug which I don't know how to fix. I made my objects grabbable when they you are on a trigger but if you grab two objects ore more at the same time they duplicate. It only happens when you grab two objects that are the same type. Please help, I don't know what to do. Thanks
@레몬-v8y
@레몬-v8y Ай бұрын
ItemName object is missing in the InventoryItem prefab. UnityEngine.Debug:LogError (object) InventoryManager:ListItems () (at Assets/Scripts/InventoryManager.cs:71) UnityEngine.EventSystems.EventSystem:Update () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:530) I got this error and changed to , but the cause persisted, so I looked into it and found that I had not changed the name to 'ItemIcon' and 'itemName' inside the 'Item' prefab. Thank you for the great lecture.
@tituskizer6478
@tituskizer6478 10 ай бұрын
Thank you so much!!! This was the only method that worked for me.
@SoloGameDev
@SoloGameDev 10 ай бұрын
Great to hear!
@markjeromedelacruz114
@markjeromedelacruz114 2 жыл бұрын
Thx .Nice easy beginners guide. helped plenty!
@mlucifer79
@mlucifer79 Жыл бұрын
First thanks for amazing tutarial , in InventoryManager script on this line :: InventoryItems = ItemContent.GetComponent(); in in top of script as you said in video i write : public InventoryItemController[] InventoryItems; I get an error as below : error CS0029: Cannot implicitly convert type 'InventoryItemController' to 'InventoryItemController[]' Can you please help me or anyone who knows this problem ?
@degiguess
@degiguess Жыл бұрын
I have the same error
@antalaai
@antalaai 9 ай бұрын
if anyone stumbles on this, it is --GetComponentS-- with a "s"
@dex4075
@dex4075 Жыл бұрын
4:40 in , when i make a new item they have no scri[t and will not let me add one but the ones in the video have script defaultly sent to item
@carloscastro4398
@carloscastro4398 2 жыл бұрын
So simple and detailed video, it's now going to help to start working wid softsoft!!
@jarrahtree5130
@jarrahtree5130 2 жыл бұрын
This tutorial was incredible!
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Thanks :)
@trunerso151
@trunerso151 2 ай бұрын
Hi bro, very good video and tutorial, I wanted to ask you, in my game I have swords as items, would this system help me to activate the swords during the game without destroying them and switching between them?
@Johnlehoule
@Johnlehoule 2 жыл бұрын
The video and explanation are pretty good, but the movement of the computer mouse is way too fast for my eyes and brain to catch. A lot of times I have to go back a few seconds or pause and watch and pause and watch, just a friendly suggestion.
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Thank you for your suggestion :)
@SoloGameDev
@SoloGameDev 2 жыл бұрын
@@Annefree98 I am sorry for this. I will be very careful with this situation. Thanks.
@ayrtondanielduarte5532
@ayrtondanielduarte5532 2 жыл бұрын
BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Thanks :)
@sirtristanus2017
@sirtristanus2017 10 ай бұрын
it would be awesome to share the assets used please ! cool tutorial thanks
@EhMerdeProductions
@EhMerdeProductions Жыл бұрын
Hey, my items are showing if I open the inventory After picking them up. I can delete them, close the inventory, and the correct amount shows up if I open the inventory again. But if I delete items and press on Open inventory while it is opened, I get more Inventory items than I have Items listed in the Items... I get extra items that says ''missing inventory item''. It is like sometimes I get ''missing inventory items'' and if I delete 1 or 2 items while I have 2 missing items, the items comeback (they are not getting deleted from the Items list). Any idea why it would do that? it feels like my number of items in the list and in thhe InventoryItems is not really sinc'ed correctly?
@lucamiletti3527
@lucamiletti3527 11 ай бұрын
Thank you so much this helped a lot!
@romanrussu3403
@romanrussu3403 Жыл бұрын
if you are keep getting an "Object reference not set to an instance of an object" error, try to replace this line: var itemName = obj.transform.Find("ItemName").GetComponent(); by this: var itemName = obj.transform.Find("ItemName").GetComponent(); and don't forget to import namespace: using TMPro; I struggled with this for a long time, I hope it helped someone
@seagoat9750
@seagoat9750 Жыл бұрын
This certainly helped me! Thank you so much!
@StormyYay
@StormyYay Ай бұрын
Thank you ive been strugling for ages with this
@wumpernugget1243
@wumpernugget1243 Ай бұрын
The part where he changed where it was grabbing the item name and icon from just did not work for me. I changed it the same way and I still get the exact same error and I have no idea what to do to fix it
@NoName-pq7ot
@NoName-pq7ot 4 ай бұрын
you are the best bro 💜
@SoloGameDev
@SoloGameDev 4 ай бұрын
Thanks :)
@myth6628
@myth6628 4 ай бұрын
this was really helpful. Thank you
@mlgjman1837
@mlgjman1837 2 жыл бұрын
HELP! When I Pick Up the item it does not show in the inventory, but when I open the inventory again it appears, everything else works fine!
@rileysorensen6796
@rileysorensen6796 Жыл бұрын
In the listItems, where it is using the Find function, how should I be utilizing this? i'm a little confused on this, moreover what should be named ItemName and where does he have it
@GawainPlayz
@GawainPlayz 6 ай бұрын
Hey i know its been a while but is there a chance you could make a video leading on from this one that implements a saving and loading system for the inventory?
@troyna77
@troyna77 Жыл бұрын
CONFUSED WITH scroll wheel positioning ? just in case anyone is wondering why the instructor's scroll wheel went to the right when he was setting the PosX with a negative (-341.43), Its because his Z axis is pointing towards you the Player. Some people point the Positive Z axis towards the game's event horizon.
@bowshattersg7776
@bowshattersg7776 10 ай бұрын
Thanks for this! It works but any attempt I made to modify it to suit my needs doesn't work such as Item Stacking. (Edit: Nevermind I found out why, explanation below) How I did Item Stacking was to make a public int quantity in the Item script. Then in the ItemPickup script, under PickUp function, we use a for loop to loop through the List Items from the InventoryManager instance to check the name. If an item with the same itemName already exist in the list, we add 1 to the quantity.
@calebcronin7296
@calebcronin7296 10 ай бұрын
How do you fix the problem of index being outside bounds of array when removing object from inventory for the SetInventoryItems() method? Would appreciate a clarification on why this happens if you got the time thank you
@bowshattersg7776
@bowshattersg7776 10 ай бұрын
@@calebcronin7296 Honestly, I'm the wrong person to ask as I haven't even encountered that problem yet. What I'm experiencing now however is that clearing the list or removing an item from the list results in the Item losing their reference to the Item prefab.
@SciencewithIrfan
@SciencewithIrfan Жыл бұрын
8:51 The error still comes when I change Item/ItemName to ItemName at this line: var itemName = obj.transform.Find("ItemName").GetComponent(); Please fix this error
@stormyyay401
@stormyyay401 Жыл бұрын
Im having an issue with the dropping system and keep getting the IndexOutOfRangeException error and dont know how to fix it. Any guidance or help would be appreciated
@Fridolinum92
@Fridolinum92 11 ай бұрын
same issue here. if you close and reopen its works normal.
@khushikhan-iz7jt
@khushikhan-iz7jt 6 ай бұрын
were u able to fix this
@muhammadfaturohmanristiant960
@muhammadfaturohmanristiant960 2 жыл бұрын
Thank you ! You did a great job simplifying such a complex daw....Looking forward to be a great producer
@SoloGameDev
@SoloGameDev 2 жыл бұрын
Thanks :)
@klimklymenko3585
@klimklymenko3585 Жыл бұрын
Hi! On the way of creating inventory I caught a problem with recognising the item name and icon. Timecode is - 8:20. So I try to understand what it means "ItemName" and "ItemIcon" and their links. Maybe I have different names, or something else. Could you help me please?
@felixtedesco4136
@felixtedesco4136 Жыл бұрын
Hey. I am in the same problem...
@scoopish2880
@scoopish2880 Жыл бұрын
I just circumvented this entirely, with a bit of issues that I eventually solved. How I did it was by making a child GameObject called ItemIcon (and you can do the same for the name-) which was just an image, and I changed the "ItemIcon=obj.blahblahblah" into "Image itemIcon = objSprite.transform.GetComponent();" and added the line "GameObject objSprite = obj.transform.GetChild(0).gameObject;" It works fine for me and I bet you could basically just do the same thing with the name, just with a bit of tweaking.
@scoopish2880
@scoopish2880 Жыл бұрын
"GameObject objSprite..." should go ABOVE "Image itemIcon..." and below "GameObject obj..."
@coolaps8786
@coolaps8786 Жыл бұрын
@@scoopish2880 Thank you soooooo much. I don't quite understand it, but it works!
@dantheman3825
@dantheman3825 Жыл бұрын
@@scoopish2880 I know you made this five years ago but I still would love to say a HUGE MASSIVE THANK YOU! I was spending my whole day trying to fix this error and thankfully you saved my day!
@starfall6286
@starfall6286 2 жыл бұрын
Hi there, thank you so much for the tutorial! It's working great for me 😀. One question, I'm trying to limit the amount of items in the inventory, could you give me some advice to start on this?
@SoloGameDev
@SoloGameDev 2 жыл бұрын
You can add two int variable for this. One of them sizeLimit the other one is currentLimit. Before pickup the item you can set control like if (currentLimit
@starfall6286
@starfall6286 2 жыл бұрын
@@SoloGameDev Thank you so much for the reply!
@dsever1966
@dsever1966 Жыл бұрын
Hi everyone I’m looking on how to make stack in this inventory because if I have clear list of items as different function I can’t really make stack system. Any advise?😢
@KBB-f7v
@KBB-f7v 3 ай бұрын
When i click an item it doesn't show in my inspector under Content nor in my inventory?
@holywaddawadda5376
@holywaddawadda5376 2 жыл бұрын
The tutorial is great, but i'm having trouble trying to add two different kinds of objects with buttons that work differrently and none of the items in the Items list is being added into Inventory items list.
@Edu98CA
@Edu98CA 2 жыл бұрын
Nice tutorial, but I have an issue when picking up more items apart from the first. Are added to the list properly, but the "InventoryItemController array" shows the items picked and an extra slot for each one with a missing item. Any idea? Thanks.
@miki47lopez
@miki47lopez 2 жыл бұрын
Same issue.
@Ash-sq5bs
@Ash-sq5bs 2 жыл бұрын
Someone a few comments down suggested for a similar problem to put the clean function from ListItems() in its own function, and call that function when you close the inventory in addition to calling it in ListItems(). Fixed the missing item bug for me.
@banaanimies9160
@banaanimies9160 2 жыл бұрын
@@Ash-sq5bs thank you
@pimbiezogman2312
@pimbiezogman2312 2 жыл бұрын
Had the same problem, I removed public void SetInventoryItems() function and did that part in the same for loop that creates all inventory objects, so now there's no array
@chritsfootballs
@chritsfootballs Жыл бұрын
Could you ellaborate on how you did this
@Ascio-Studio
@Ascio-Studio Жыл бұрын
Thanks you for this tutorial! If I like to collect the items with player collision, can I replace Input fonction by trigger enter fonction? I need help please!
@tituskizer6478
@tituskizer6478 Жыл бұрын
Yes, I tried it with a non trigger collider and I can collect the objects, I don't think the trigger should work any differently. :)
@Sharmiyt_
@Sharmiyt_ Ай бұрын
What about drop system and adding if already the pickup object is picked then count + of the value picked like health kit picked 1 and again picking + the count in existing Object!…, and how to drop with different values from Scriptable Objects ??…
@markvincenttamayo151
@markvincenttamayo151 Жыл бұрын
Great tutorial! May I ask if you have a video for stacking the potions? Thankyou!
@SoloGameDev
@SoloGameDev Жыл бұрын
Sure. Thanks :)
@avve558
@avve558 Жыл бұрын
the second time i open the inventory the items i had before and the new items i picked up have switched names and icons with each other and the old items can't be used.
@voidstarstudio8070
@voidstarstudio8070 Жыл бұрын
This was helpfull. But is thare a way to add stacking so i item like worl dont take 99 slots but 1
@dsever1966
@dsever1966 Жыл бұрын
Hey the same issue if u use a clear list as a different function I think that’s impossible because I trying to do that 5 days
@chritsfootballs
@chritsfootballs Жыл бұрын
When I call setinventoryItems my controller array is filling with items that have missing objects then adds the items from my inventory last. Any thoughts
@jocopowell
@jocopowell Жыл бұрын
Would it be better for me create the inventory slots via the editor (such as in this video) or Instantiate them with c#?
@pedrammoradi6841
@pedrammoradi6841 2 жыл бұрын
This was a great tutorial video! Thanks
@realb4825
@realb4825 Жыл бұрын
I am stuck since when I collect the item it is destroyed but does not appear in the inventory I have connected everythign the same as him but it just does not work.
@ItsMinticle
@ItsMinticle 2 жыл бұрын
whenever i press on an item like at 15:32 to use it, i get an "Object reference not set to an instance of an object" error, any help would be appreciated since i just cannot figure it out
@gabrielklark3357
@gabrielklark3357 2 жыл бұрын
I was getting this problem when I created my UI using TMPro, but on my code I was doing like him and looking for a component, instead of
@colinc6209
@colinc6209 2 жыл бұрын
did u ever find the solution to your problem, i am having the same one
@ItsMinticle
@ItsMinticle 2 жыл бұрын
@@colinc6209 no, sorry. i just followed the inventory tutorial by Brackeys and Sebastian Lague instead lol
@Akira-xr9tv
@Akira-xr9tv Жыл бұрын
i have a problem when i open then colse then open the inventory again the item loseses the scriptebel object reftence;
@gmangman123
@gmangman123 Жыл бұрын
hi again master. How can we save and load these items? Thank you.
@yipa6096
@yipa6096 Жыл бұрын
at 11:05 it's"Item item;" but at 12:30 it's "public Item item;"
@IgniteWavee_
@IgniteWavee_ Жыл бұрын
thanks
@vyechi
@vyechi 7 ай бұрын
Is the inventory system based on swords and shovels tutorial?
@Pausechallengesandfunnystuff
@Pausechallengesandfunnystuff 9 ай бұрын
How do you make it so that you can add your backgrund to the inventory at 0:52
@unitynocode
@unitynocode 2 жыл бұрын
so complicated :( thats why I hate C# code . Very nice game and video. Thanks so much ❤
@ranijabrael3673
@ranijabrael3673 Жыл бұрын
you think C# is complicated? lol
@unitynocode
@unitynocode Жыл бұрын
​@@ranijabrael3673 Not really. But you need to google everythings if you need 1 event to do somethings. I can explore any events in C# easily by myself with Visual Scripting. That's what I mean :)
@virtualcity365
@virtualcity365 2 жыл бұрын
How about save and load Inventory System?
@seymaple
@seymaple 2 жыл бұрын
Awesome tutorial! unfortunately I've been stuck at the items showing up with icon and name, and more items. They show up in my inventory manager but somehow don't want to transfer over to my actual visual inventory :(
@MOBVegas
@MOBVegas 2 жыл бұрын
Im getting the same issue, did you ever end up resolving the issue?
@seymaple
@seymaple 2 жыл бұрын
@@MOBVegas yeah, for me it had to do with the Items.add(item) in the inventory manager and the button involved to add/list all those listed items to the inventory. But My set up is way different from the tutorial.
@seymaple
@seymaple 2 жыл бұрын
@@MOBVegas good luck thou, it was extremely frustrating
@MOBVegas
@MOBVegas 2 жыл бұрын
@@seymaple yeah im also using the script differently, i got the item to pickup using the OnTriggerEnter and items place in the inspector just not visually in the inventory yet. Thanks for the reply tho, glad you worked it out
@mayslae
@mayslae Жыл бұрын
@@MOBVegas did you ever get this to work im also using ontriggerenter and ive been struggling for 2 hours now
@DesignMade-Easy
@DesignMade-Easy Жыл бұрын
hey thank you so much for the explanation, can you just help with one thing, I modified the code so that items in inventory manager are stackable. the issue I'm facing is with deleting I only want to destroy the item when amount ==0 but its not workingout with me I'm not able to destroy object in inventorymanager cz it will destroy the inventory and I cant destroy object in inventoryitemcontroller cz I need to check amount from inventory manager. aby ideas please
@SaraAnnese
@SaraAnnese Жыл бұрын
why am I not able to drag the text of exp and health in the health text and exp text in player script?
@SaraAnnese
@SaraAnnese Жыл бұрын
so, i follow the tutorial and is the first tutorial without errors in the code, but why I'm not able to collect the object in the inventory? When I interact with them, they remain in the same place.. Some suggestion?
@YourDrive26125
@YourDrive26125 2 жыл бұрын
creating a second track to add into the recording as I play through the first tract?
@afifasri7690
@afifasri7690 2 жыл бұрын
Hey great tutorial but i am having huge problems with the ListItems() method The error is that: the parameter named item cannot be declared in the scope because the name is used in an enclosing local scope to define a local or parameter
@ElCurios
@ElCurios 2 жыл бұрын
if you're still having the problem i think this means you already have a parameter (maybe a float, gameobject ect.) named "item" You can try to use a different name or try typing the "i" big like "Item"
@angel200iq8
@angel200iq8 25 күн бұрын
"GUI parts" is the package used for icons
@dex4075
@dex4075 Жыл бұрын
at 8:15 im getting an error CS0246:the type or namespace 'Text' could not be found and the same with 'Image'
@flamen3158
@flamen3158 Жыл бұрын
exactly the same issue. If anyone has an idea, please let me know!
@flamen3158
@flamen3158 Жыл бұрын
I found the answer somewhere in the comment section!: if anyone else is wondering how to fix this : you need to add using UnityEngine.UI; line
@raindrop650
@raindrop650 Жыл бұрын
Where do you add it?
@flamen3158
@flamen3158 Жыл бұрын
@@raindrop650 on the top part of the script
@raindrop650
@raindrop650 Жыл бұрын
@@flamen3158 yeah some reason the Items aren't showing up in my Inventory. I click on the object and nothing oof.
@naaay705
@naaay705 Жыл бұрын
Hey, What if I have some items in inventory before I store other item? How can I prevent those items from being destroyed when I store another item to Inventory?
@mysterouswafle2198
@mysterouswafle2198 Жыл бұрын
i have a problem, when i open the inventory twice it removes the item component from my inventory item controller
@Ascio-Studio
@Ascio-Studio Жыл бұрын
Hello I cam late. Thanks you for this verry explained tutorial. I have a problem: input button submit is not setup This problem shows and I like fixe it.Please help !
@jamesperez386
@jamesperez386 Жыл бұрын
May I know what type of object is the Content?
@МаксимЛеонтьэв
@МаксимЛеонтьэв 11 ай бұрын
a really nice tutorial
@SoloGameDev
@SoloGameDev 11 ай бұрын
Thanks :)
@heal4386
@heal4386 Жыл бұрын
I cannot delete the items from the inventory and the UI does not update, and everything is assigned and it shows no error
@Jon2mil
@Jon2mil Жыл бұрын
Did you fix this?
@trillobit3sIndieGames
@trillobit3sIndieGames 9 ай бұрын
Você tem um sistema de inventário com gamepad?
@draguan1864
@draguan1864 Жыл бұрын
Does anybody know where can I find this specific asset pack for the UI?
@notBradYourself
@notBradYourself 2 жыл бұрын
Overall this is a great tutorial, but I would advise against using 2x find in a foreach. There are definitely more performant ways to access picture/name - especially if you have hundreds of items or are calling this often. Great tutorial overall though!
@CHEEZEyCHEEZE
@CHEEZEyCHEEZE 2 жыл бұрын
What are the ways?
@murphhsstudio7098
@murphhsstudio7098 2 жыл бұрын
He is right, have had nothing but trouble with this section: foreach (var item in Items) { GameObject obj = Instantiate(InventoryItem, ItemContent); var itemName = obj.transform.Find("ItemName").GetComponent(); var itemIcon = obj.transform.Find("ItemIcon").GetComponent(); itemName.text = item.itemName; itemIcon.sprite = item.icon; }
@mihnwq9211
@mihnwq9211 Жыл бұрын
@@CHEEZEyCHEEZE public void add(Item item) { if (amount[item.id] == 0) { items.Add(item); GameObject obj = Instantiate(inventoryItem, itemContent); var itemName = obj.transform.Find("ItemName").GetComponent(); var itemImage = obj.transform.Find("ItemIcon").GetComponent(); itemName.text = item.itemName; itemImage.sprite = item.icon; } setItems(); } and you escaped of the for Loop for setting the items
@mihnwq9211
@mihnwq9211 Жыл бұрын
and also same logic for deleting items
@pocoace5415
@pocoace5415 Жыл бұрын
i follow your tutorial but when i reach to public void SetInventoryItems() i always error even i follow it all it says index was outisde bounce of array
Be CAREFUL with Scriptable Objects!
8:27
Code Monkey
Рет қаралды 82 М.
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 22 МЛН
DID A VAMPIRE BECOME A DOG FOR A HUMAN? 😳😳😳
00:56
Why Solo Developers Should Use Unreal
9:51
Thomas Brush
Рет қаралды 401 М.
Unity ScriptableObject. Пишем простой инвентарь
6:08
Insane One - Разработка игр
Рет қаралды 47 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 720 М.
How Two People Created Gaming’s Most Complex Simulation System
38:54
ThatGuyGlen
Рет қаралды 1,4 МЛН
Drag and drop in Unity UI - create your own inventory UI!
12:47
Coco Code
Рет қаралды 110 М.
Creating An Inventory System in Unity
11:03
Game Dev Guide
Рет қаралды 181 М.
How to Crack Software (Reverse Engineering)
16:16
Eric Parker
Рет қаралды 632 М.
FULL PICK UP & DROP SYSTEM for WEAPONS or ITEMS || Unity3d Tutorial
5:45
Dave / GameDevelopment
Рет қаралды 187 М.
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 192 М.
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2 МЛН