КОМЕНТАРІ •

  • @jenniferroth7824
    @jenniferroth7824 4 роки тому +8

    This is a great series! Easy to follow and gives solid information. Also like how you are layering the concepts but not getting too far into the extra details.

  • @techno_tuna
    @techno_tuna Рік тому +12

    I just want you to know your tutorials are not only helping me make an inventory system, but helping me to learn a LOT of stuff around it as well.

  • @brandons2501
    @brandons2501 4 роки тому +10

    Here after watching the first video, I love the way you explain certain things, it makes it really clear (although I'm still pretty new so I don't really understand most things yet... hopefully, that'll change) anyway just want to say thank you. This is an amazing series and I intend to watch the whole playlist.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +2

      Great to hear! Hope you learn something :)

  • @zero-to-100
    @zero-to-100 2 місяці тому +1

    As a non-English speaker, Other lectures are hard to listen. However, this lecture is well explained and easy to understand to your voice full of passion and confidence.
    The quality of the lecture is very good. I'm glad I searched for the ScriptableObject Inventory lecture before implementing the inventory function as "Playerprefs". (It's terrible just to imagine.)
    Best lecture ever, Best teacher ever. I shared it to another developer. Have a great day.

  • @salomonestigarribia5731
    @salomonestigarribia5731 Рік тому +2

    You are amazing at explaining everything, you don't have a clue on how much you're helping me, thank you so much

  • @Dan-Levi
    @Dan-Levi 4 роки тому +9

    Been following along and just wanted to say thank you for providing us with great Unity content. Greetings from Norway 👍👍👍😃

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +2

      Hilsener!
      Thanks a lot, glad your enjoying it

    • @exon878
      @exon878 3 роки тому

      @@CodingWithUnity u from norway or just google translate?

  • @mrman7009
    @mrman7009 4 роки тому +3

    Thank you for putting out these videos, they are excellent, straight to the point and I like that you started from scratch in Unity with these tutorials. Because of this I can understand what each part of your code does a lot easier. Learnt a lot so far!

  • @sodanice3214
    @sodanice3214 Рік тому

    What a great tutorial to learn not only the inventory but also the basics of the save function!

  • @duane7032
    @duane7032 2 роки тому +2

    Great ! no problems at all working very smoothly so far about to start the next episode !

  • @mehmedcavas3069
    @mehmedcavas3069 3 роки тому +3

    these are really valuable tutorials that are a must for developers. If you want to make a real game then these kind of videos are important

  • @meandmyself1600
    @meandmyself1600 3 роки тому +1

    Thanks a lot for this tutorial! I like the idea of scriptable objects but was a bit stuck with the saving part. Ended up with some wicked text replacement within the json string. Those After/BeforeSerialization methods are a blessing.

  • @shakedlevi32
    @shakedlevi32 2 роки тому

    Remarkable!,
    Ending the day with a new part from this tutorial is very relaxing and teaching.
    Thanks man

  • @Keolamation
    @Keolamation 2 роки тому +1

    yeah, not many people realize how important it is to securely write out objects and write them in for MMORPGs thank god you made this. I was using referencde structs to populate my games items before i saw this and saw the callback receiever. now, im gonna experiment with this for another week or two and see if i can get result i like. xD

  • @neffthepanda
    @neffthepanda Рік тому

    Another great video! Loving this tutorial series.

  • @yapsharlene
    @yapsharlene 4 роки тому +4

    super big thanks!!
    i love your content! you make these really easy to understand. 😊💕

  • @toaitran7444
    @toaitran7444 3 місяці тому

    Man, there are so many inventory issues that have been bothering me for 2 weeks, today I'm so lucky to have found your video. I like the way you explain when writing code, as there are many techniques if you don't explain, then I wonder: how can I learn this on my own? I love you! Wishing you many interesting experiences in life!❤

  • @neilamess237
    @neilamess237 4 роки тому +5

    I don't normally comment on videos but I feel in this case I have to. You are by far one of the best tutors in C# in Unity that exists on UA-cam. You explain clearly what you are doing and why and in such a way I can actually understand you; and it makes a lot of sense. However, I am experiencing the same problem as elcamp3 in that my Save and Load procedures only work if I use them as soon as the game starts (with no items in the Player Database). Once I collect some objects they no longer fire. Will continue to try and solve the issue (I hate to give up) but any information you can provide will be much appreciated. Keep up the excellent tutorials, I look forward to finishing this project.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +1

      Are you getting errors?
      Be easier to help you on discord, so feel free to join it!

    • @neilamess237
      @neilamess237 4 роки тому +5

      Thanks, but I solved the problem. There was nothing wrong with my code, I can't believe I'm going to admit this. When I used my player to collect some objects the focus was on the Scene View so none of the keys would work in game view. Once I switched focus to Game View everything worked. That is a mistake I will not be repeating.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +3

      @@neilamess237 Hahaha that's hilarious :)

  • @TheJakeblake
    @TheJakeblake Рік тому

    Thank you very much for this it was really helpful, now I'm going to continue onwards with the series.

  • @MrRipper55
    @MrRipper55 2 роки тому

    Following along trying to understand some of the concepts, but I'm quite new in programming so this one was tough - at least it works :) I have no idea what most of this code means for now, ill try my best to understand it. Anyways the best inventory system I've seen so far, thanks for sharing your knowledge, im very grateful!

  • @JasonWelch
    @JasonWelch Рік тому

    Damn, the item database solution is brilliant! I can think of a number of improvements to it such as creating different database assets for different item types, but I think this is the solution I'm going to go with. Thanks!

    • @JasonWelch
      @JasonWelch Рік тому

      Finished implementing this last night. Wound up making a base ItemDatabase so that I could extend it with specific item types.

  • @EduardoYamauchi
    @EduardoYamauchi 4 роки тому

    This video is very useful and didactic, please make more videos like that!

  • @masonmason22
    @masonmason22 2 роки тому

    Very helpful. Thank you so much for making these videos.

  • @berkalkan3382
    @berkalkan3382 3 роки тому

    best tutorial i've ever watched so far!

  • @hmcq6
    @hmcq6 4 роки тому +5

    These tutorials are awesome! Thank you!!
    I've been programming 20 years but I've always found Unity intimidating. These tutorials are perfect, better than the selection on Unity Learn Premium.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому

      Really glad your enjoying them!
      Also awesome to hear i appreciate it :)

  • @davescellphone5376
    @davescellphone5376 3 роки тому +1

    I think, thank you for these videos. I'll have to watch about 19 other tutorials to understand most of what you're talking about but it looks far beyond what I will need.

  • @user-hm2is2ex9f
    @user-hm2is2ex9f 7 місяців тому

    Thanks a lot. This helped me a lot in understanding to write my own scriptableobject. Great stuff. It's a shame you no longer making new videos.

  • @buraqalaeli6619
    @buraqalaeli6619 2 роки тому

    Amazing and informative tutorial! Recommend 10/10 would buy again... :P

  • @nv7287
    @nv7287 2 роки тому

    This is such an amazing tutorial - I hope you dont mind, but If I could make a suggestion... to do a code review off the classes...
    it would help with debugging... (often downloadble projects dont nessasrily match what is happening in each stage, which makes it tricky to see where Ive gon wrong...) None the less this is really the best tutorial Ive seen so far on this topic - and Im so thankful for it!

  • @niklaskras5498
    @niklaskras5498 3 роки тому +1

    uff gotta watch it again. i´m new to all of this but thx for the video!

  • @sevemz3359
    @sevemz3359 3 роки тому +1

    Thanks, it works on android. For those who want to use it on android, you just need to plug it to a save and load function

  • @qiangpanchen6785
    @qiangpanchen6785 2 роки тому

    Super Duper good! Love your tutorial ~

  • @ZukuseiStudios
    @ZukuseiStudios 4 роки тому

    Great videos, well structured, thank you

  • @laggard31
    @laggard31 4 роки тому +29

    T H A N K Y O U SO MUCH!
    I've learned SO SO much from just these 2 videos so far!

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +3

      That is awesome!

    • @galdar9618
      @galdar9618 2 роки тому

      Learned nothing yet, but!..
      REAL learning gonna begin when I'll try to make this system fit for my game

  • @ashfidislam1321
    @ashfidislam1321 4 роки тому

    Always excited to watch your videos man!
    What are we seeing next btw?

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +4

      Im going to do a few more videos on this series, i want to show how to make an equipment screen and a bank
      Im also considering making a combat system and combining the leveling/inventory/and combat system videos into a game in another video (but dont hold me too it)
      Im also following the new dots networking and may consider doing videos on that down the road.

    • @ashfid8987
      @ashfid8987 4 роки тому

      Coding With Unity Oh man, this is exciting. Really loving the RuneScape related videos. Rarely I find videos with inventory system or any system that relates to RuneScape.
      Great game to get inspired on various systems. I am really liking Dots too btw. Are you working on any real project right now?

    • @hotadoga00789
      @hotadoga00789 4 роки тому

      @@CodingWithUnity Would you be willing to try, or show, some sort of basic crafting system. Combining two or more items to create a third item?

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому

      That should be simple to do, ill think about it and see if i can make a video on it near the end of this series!

  • @nv7287
    @nv7287 4 роки тому +1

    Really awesome thanks

  • @therondoshow
    @therondoshow 2 роки тому

    I'm a little confused about where the save files are created? It seems the save file when playing inside the editor is different than with a build. I'm on a Mac - and when I play in the editor it gets saved to Library/Application Support/DefaultCompany/ProjectName/. But the Build seems to be saving elsewhere because if I delete that file at that path, and create a new one with the build, it doesn't show up in that folder. The saving/loading functionality IS working though. Any idea where the build is saving the file? I'm so confused.

  • @nguyenchidi8148
    @nguyenchidi8148 Рік тому

    amazing course!

  • @huyopo
    @huyopo 4 роки тому +13

    Just for notice: it's a myth that the + operator for strings is less performant.
    Somehow everyone seems to believe that, but it's not true. It's actually in most cases the most performant.
    The myth comes from when you do iterations where you add stuff to a string, it can take a lot of time, as every iteration it creates a new string, but if you just do it inline, the compiler knows it and does it in a optimal way.

    • @MyCiaoatutti
      @MyCiaoatutti 3 роки тому +1

      Exactly. Even Microsoft recommends using the + operator. Basically, by using the + operator, the C# compiler will evaluate which concatenation method to use based on performance. Sometimes, you just have to trust the compiler and write simple code

    • @stevenjeanne4156
      @stevenjeanne4156 2 роки тому +1

      @@MyCiaoatutti I Believe microsoft recommend using the String Interpolation operator $"{variable} {variable2}".

    • @WelshGuitarDude
      @WelshGuitarDude 2 роки тому

      The performance hit is due to heap allocation and unity has a poor outdated garbage collector, so it's more unity specific

    • @nikoart1561
      @nikoart1561 6 місяців тому

      Absolutely disagree using + generate more garbage collection. There's a better solution is using ZString in order to use concat, direct text without any allocation, Join and Format. Each + operator allocate more and more garbage until your game start to have some stutters and lag

  • @philberex
    @philberex 3 роки тому

    Thank u for this wonderfull tutorial.

  • @glenzhang3646
    @glenzhang3646 4 роки тому +4

    very good stuff, it'll be even better if you can explain more XD

  • @stevenjeanne4156
    @stevenjeanne4156 2 роки тому +1

    At 14:30 you could use using FileStream. (Thus not needing to call Close).
    And Use Path.Combine instead of string.concat().

  • @Bulletforpaul
    @Bulletforpaul 4 роки тому +4

    Thanks for your videos. I am learning a lot with these.
    A suggestion would be, instead of using the double Dictionary we can just use the index i of the items array.
    the code for this in the ItemDatabaseObject.cs would then look like this:
    public ItemObject GetItemById(int _id) {
    if (_id >= items.Length) {
    return null;
    }
    return items[_id];
    }

    • @chrisflynn5192
      @chrisflynn5192 4 роки тому +1

      Just posted a comment asking if there was any real reason not to do exactly this. Seems over complicated and unnecessary but thought I was maybe missing something...

    • @ryanbeattie9170
      @ryanbeattie9170 2 роки тому

      This does indeed seem to work for me. Thanks for the comment!

    • @stevenjeanne4156
      @stevenjeanne4156 2 роки тому

      @@chrisflynn5192 If you want to use GUID as your ID, you won't access your array by index. It works here because int _id is an "int". And the ID of the object are their indexes.
      If you have an Item[5] and one of your item has 123 as it ID. Accessing items[123] will throw an exception with ArgumentOutOfRange.
      While with a dictionnary you could have
      [123] : Item
      [235] : Item
      [1] : Item
      or if you key is a string
      ["wood"] : Item
      ["water"]: Item
      ["somethingelse"]: Item.
      Then you access your item dictionnary with : MyDictionary[Item.Id].

  • @mrworld8494
    @mrworld8494 2 роки тому +1

    ok so i have a problem the inventory is not showing the items when i build it but runs perfectly in editor mode help!

  • @DakotaWinz
    @DakotaWinz 2 роки тому

    this dude is bonk and all over the place... trying to follow the tutorial... good explanations but crazy execution O_o

  • @channeltrash6257
    @channeltrash6257 2 роки тому

    how can i save multiple databases? cuz i can create worlds, several worlds in which the save path is different. so if i'm in the "New world 1" that's my save path and the game loads my data which is saved in the "New World 1" folder.

  • @Mr.NorwegianMarcus
    @Mr.NorwegianMarcus 4 роки тому +1

    I may be doing something wrong but when I pick up an item and save, then pick up 1 or more items of a different type and then finally reload it seems like the items that isn't saved dosen't get removed VISUALLY...It's like it UI dosen't update when going to remove slots it just adds them

  • @spokloo
    @spokloo 2 роки тому +1

    hey when i press enter multiple times, it loads and displays the slots over the existing ones, how can i fix this ?

  • @Dmitri-kz7gs
    @Dmitri-kz7gs 5 місяців тому +1

    Hi! Can i make, that saving system is working every second(update()), and load the inventory in start?

  • @mpaggget
    @mpaggget 4 роки тому

    I’ve been trying it you’re video helped so much thanks I tried many other tutorials but never learned anything especially brackys but i can’t register the items do you know what’s the problem?

  • @seanballard2546
    @seanballard2546 2 роки тому

    ok so this is a old video but ive followed everything perfectly but i cant get the save and load from pressing "space" and "enter" to work. i do have a character controller that uses the "GetKey("Space") for jumping in my character controller so would that be the problem?

  • @tinhonlien
    @tinhonlien 3 роки тому

    sory I want to ask
    Why when I build the pc, and run the program it does not show the item in the inventory
    but in the unity editor run ok

  • @darrylvillanueva5233
    @darrylvillanueva5233 2 роки тому

    i have facing a problem on Load function when i put the load function on OnDisable function all the save data are deleted! can someone help me please?
    Thank you!!

  • @vergilw7009
    @vergilw7009 2 роки тому

    Hello, I`m new to Unity , I want to ask if add an Item_ID on the Item Scriptable Objects, then put each Item an unique ID, is it work for not adding the database section ??

  • @Thundorn
    @Thundorn 11 місяців тому

    is there not a method we can add to the ItemObject which automatically appends itself to the database when it's created so that we don't have to manually add each item? I would like to make it more designer friendly.

  • @alexold4126
    @alexold4126 3 роки тому +1

    when i build and run , in the game save&load dont work, and my player dont interact with objects :/
    can someone help me with that?
    In unity all works good. but in game no :(

  • @kl3mta3
    @kl3mta3 2 роки тому +4

    So in the editor everything works perfectly, and when i build it completes with no errors, and saving/loading works. However, my player when walking over the item prefabs, doesn't pick them up or add them to the inventory.
    If I build the game with items already manually added to the player inventory, then it works as intended.
    Again, only for clarification, if I hit play in the editor with the player inventory empty it works, but will only work after built if the inventory has items already in it.
    Would anyone know why this happens? I've checked my code with the tutorial a few times and cant see any difference.

    • @bladyops9900
      @bladyops9900 Рік тому

      I know this is one year after you posted this, but in case anyone else has this issue, make sure your path is correct to your database after you move it to the resources file! In your “OnEnable” method in your InventoryObject script, the path file should be “Assets/Resources/Database.asset”.
      Hopefully this helps at least on person!

  • @oscar_castro
    @oscar_castro 7 місяців тому

    Thanks a lot.

  • @cast_games
    @cast_games 6 місяців тому

    Thanks!

  • @tapanmohanta9002
    @tapanmohanta9002 3 роки тому

    Thank you for nice tutorial.. please do drag and drop item from Inventory to world.. thank you.

  • @ahmadtaib6199
    @ahmadtaib6199 Рік тому

    how to save using cloud storage like cloudonce? did anyone know? please im stuck around 5 month right now for android

  • @magicpepe582
    @magicpepe582 2 роки тому

    it is okay to use json to save and load your game? i mean i want my data more secure to prevent hacked or changing the data

  • @joshuadecator6416
    @joshuadecator6416 4 роки тому +2

    Everything seems to be working besides when i go into build i no longer can pick up the items, but the save and load works :)

  • @prototype21
    @prototype21 4 роки тому +6

    I'm 2 weeks into Unity & coding so this is over my head but somewhere before you changed the database from public to private, the item ID paramater in player inventory no longer works in identifying which item you are loading out your inventory with. If you hit play while your player inventory's load-out is set to container size at 0 and or items set to none, picking up items while colliding won't work. In other words, you have to populate your player inventory with every item before hitting play otherwise you won't be able to pickup the said item.

  • @totalyagamedev272
    @totalyagamedev272 2 роки тому

    hey man great vid really helpfull when will you do the vid to move the items from slot to slot

    • @CodingWithUnity
      @CodingWithUnity 2 роки тому

      There should be a vid in the series called item swapping or something like that

  • @TheRealspoingis
    @TheRealspoingis 18 днів тому

    Hey So I just cant seem to find out how to save Scriptable Objects that are instanciated in a scene
    what is the best type of inventory system that allows the same item multiple times with different stats in a players inventory thats saveable??
    I have been using scriptable objects for the longest time since it allows for just creating the object over again and allowing to change the stats of those items but to make it so it saves feels impossible
    I Use CreateInstance does this work with this??

  • @RedShedG
    @RedShedG 3 роки тому

    I exported the project and they everything broke, i can only collect if i have the item allready, save doesn't work anymore, and so on :( and it's not only in the build, it's also in the preview

  • @darzeon
    @darzeon Рік тому +1

    I like the way you say IDE 😋

    • @CodingWithUnity
      @CodingWithUnity Рік тому

      Lmao, gotta love my southern accent. It's hard to get rid of loll

  • @stangstarchannel8349
    @stangstarchannel8349 2 роки тому

    Hello, I've been following these tutorials, It Was Amazing! but I have one problem, what about when removing items from inventory how do we update the display when it was all out :3

  • @chrisflynn5192
    @chrisflynn5192 4 роки тому +1

    Hey there, loving these tutorials. I've made an inventory before but not had much experience with scriptable objects. Loving them already though, and they seem straight forward so far.
    I did have a query regarding your database though. Why do you need the dictionary? If you are populating the ItemObject[] in the editor and you make sure that the ItemObject.id is the same as its index in the array surely you can access it directly using item[id]. You could then just store the database object in your resources folder. Am I missing something here?

    • @kamikaisan
      @kamikaisan Рік тому

      i totally agree with you, and that was exactly my approuch, but with a few changes, since i'm not leaving the item array and the dictionary, which i named mappedIds, as public, i made a method for the DatabaseObject: GetItem(int id) { return item[id]; } and another for GetId(ItemObject item) { return mappedIds[item]; }

  • @infernumex
    @infernumex 2 роки тому +2

    I'm having a bizarre issue with this system where InventoryObject.OnAfterDeserialize is always throwing a null reference exception. I did some head scratching and googling around, and it looks like it *might* be a Unity issue where references aren't kept after deserialization. Has anyone else had this issue? Unfortunately, I'm not experienced enough to code up a workaround.

    • @Golden_Hephaestus
      @Golden_Hephaestus Рік тому

      Hey! I'm having the same problem, were you able to find a workaround?

  • @unitygametv7406
    @unitygametv7406 Рік тому

    Invalid operation exception. You are trying to read input using the UnityEngine.Input class, but you have switched active input handling to input system. Why this error ?

  • @zyrxom
    @zyrxom Рік тому

    so after i built the game the inventory just stopped woking and I have no idea why it doesn't even work from the inspector

  • @whynot2349
    @whynot2349 Рік тому

    Really amazing tutorial!!! tysm for making the effort:D, I just had one question: when saving for example my inventory with 2 items inside, then picking up another item and loading, all 3 items show up, not only the 2 saved ones. Is that meant to happen?

  • @aswd45-mk14
    @aswd45-mk14 4 роки тому

    Hello, thank you for this series! I really apreciated! :D I have one question. Where is the save folder located? I dndn't really understand this part and I don't find the save folder. Is that normal? Because when I wrote something in a .txt, I see the .txt beind added in the folder, but not this json.. Thanks you!
    Edit:
    I found the file by addind this in the Save function: Debug.Log(Application.persistentDataPath);

  • @danielsalyi7194
    @danielsalyi7194 4 роки тому

    Could you please help me?
    Inventory works, even if I quit and reload the game. But if I update my app(mobile game), it cannot repopulate the items. Amount of the items are correct but it doesn't recognise what item it is.
    Is there a work around for this? I tried to use an array, but it break the system and loading didn't work. I am guessing the reference from the dictionaries break => cannot repopulate
    Or the database reference breaks and no loading (still using the resource system)

    • @chrisflynn5192
      @chrisflynn5192 4 роки тому

      It definitely sounds like your database reference is the issue to me. If it is then none of your ItemObject assets will be included in your build. Are you loading your database using Resources.Load?

  • @wicgamesdev
    @wicgamesdev 2 роки тому

    Works 10/10, on Windows 10.

  • @nevimkde9537
    @nevimkde9537 2 роки тому

    Awesome series, it is for me so complicated, even throught the fact, that I am into programming for 2 years (I know its nothing but still). Only one question and that is at 13:35, how exactly did you attached FileSteam to that string???

    • @ryanbeattie9170
      @ryanbeattie9170 2 роки тому +1

      Not sure if this is what u might be looking for but, just curious if u added the using System.IO; at the top. Plus the save path was is supposed to be typed in by you on the inventory scriptable object inside the inspector. Will only work if that scriptable object is in that location. Hope this was what u were looking for or talking about.

  • @andersonmartins9328
    @andersonmartins9328 2 роки тому

    I don't know if anyone will respond, but I'm having a problem where I can save inventory but can't load it. Please, if anyone knows anything let me know.

  • @eduarddebruyn4841
    @eduarddebruyn4841 3 роки тому +1

    Your videos are so great and so helpful!!
    However I seem to have an issue. When changing the ID like you do at 11:41 my Item does not update? I have followed your examples to the letter... Please can you assist?

    • @eduarddebruyn4841
      @eduarddebruyn4841 3 роки тому

      Figured it out, never had ISerializationCallbackReceiver on my InventoryObject.cs

    • @CodingWithUnity
      @CodingWithUnity 3 роки тому

      Good job fixing it!

  • @thebulletkin8393
    @thebulletkin8393 6 місяців тому

    Been working through this, but inn getting an issue that I simply cannot figure out the reason behind. Essentially, when I boot up the first scene everything works fine. On load it will add the item slots and game objects to the dictionary and update it as expected. On the second scene this works too. But when I go from the second screen to the first screen again, through breakpoints I can see that on load it correctly assigns the slots to game objects. But between the scene loading and me picking up a new item, the values in the dictionary just become null. Have you ever encountered an issue like that with this setup?

  • @drake_eric9799
    @drake_eric9799 4 місяці тому

    help pls build and run is to long loading maybe i skip making folder to other asset script

  • @connorbrush5626
    @connorbrush5626 4 роки тому +2

    When I load in my build before saving in my build, it does not load the save from my editor. It instead spams my debug log with errors and infinitely instantiates inventory slots. What could be the error? How could I fix?

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому

      It sounds like some code is in the wrong spot, but switching ISeralizationCallback with Onvalidate might help

    • @antonclark608
      @antonclark608 3 роки тому

      I encountered this issue as well. The reason it was happening was because I had the [System.Serializable] tag in front of the database variable. But the same issue would occur if it was public. Just make sure that the variable is private and cannot be read by unity.

  • @garypowell3566
    @garypowell3566 4 роки тому +2

    Can you help please...So far, tutorial going well, except for the Save & Load which is not working at all. I have tried assigning different Key Codes, but it's just not happening. Any suggestions/help would be appreciated thanks.

  • @chris_hass
    @chris_hass 3 роки тому +1

    i have error, when i try to build and run i got two errors, one says:
    Assets\scripts\inventory\Scriptable objects\Inventory\Scripts\InventoryObject.cs(21,13): error CS0103: The name 'databse' does not exist in the current context
    and second says:
    Error building Player because scripts had compiler errors

    • @hxckid
      @hxckid 3 роки тому

      Check that you added database in Editor to InventoryObject component.

  • @excuses7032
    @excuses7032 4 роки тому +2

    Hey so ive been recently following this tutorial but it always brings up an error with the resource folder when trying to build. any chance things changed since then?

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +2

      Yes, I get rid of the resource folder around video 4 I believe, cant remember for sure. But it doesn't stay long and i start doing build test at the end of the videos in one of the future videos on

    • @excuses7032
      @excuses7032 4 роки тому +1

      @@CodingWithUnity Thank you so much. Especially for responding so quickly. Your tutorials have been amazing so far and cant wait to get through the rest.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +2

      @@excuses7032 No problem! :)

  • @carlosnava1653
    @carlosnava1653 3 роки тому +3

    Hello, thanks for the tutorial, it's been a lot of help to me. Question: How would you remove an item from the inventory using this system? I'm making a simple unlock system using an item (a key) and then the idea is to discard the item. How can I access to the container's items through code? Thanks in advance!

  • @gamesarelegends3473
    @gamesarelegends3473 4 роки тому

    What did you clicking at the FileStream at 13:48? I dont have Visual Studio so I dont know what you activated.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому

      i cant see anythignt hat i clicked, just that i used string.concat (which for reference, its better to do `$"my concated strings number is {myInt}"`

  • @helpmegame
    @helpmegame 4 роки тому +1

    Couldn't you use [SerializeField] above your ItemDatabaseObject variable declaration at 19:00 instead of the OnEnable? It would allow you to still set and change the value through the editor and may work better. I'd think it would make things smoother if you moved paths around.

    • @Sekunri
      @Sekunri 3 роки тому

      His goal was to keep the database Deserialized so using SerializeField would have rendered the point moot.

  • @drake_eric9799
    @drake_eric9799 4 місяці тому

    i build it and run load is not working database is keep reseting to no database

  • @everabyss
    @everabyss 4 роки тому

    OnAfterDeserialization of InventoryObject running before the OnAfterDeserialization of ITemDatabase. which Throw error.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +1

      changing the script execution order should fix that

  • @ljhoser5842
    @ljhoser5842 4 роки тому +1

    I am getting an error that says keynotfoundexception, it says line 14 and 35, but there doesn't seem to be an issue in those lines? (it happens when the player touches the item)

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому +1

      it probably is not finding the item in your item database

    • @danielsalyi7194
      @danielsalyi7194 4 роки тому +1

      Try this:
      In the for loop for get item,
      Write:
      If(database. Get item. Containskey(container[I]. ID)
      //populate that item

  • @vandermunnik
    @vandermunnik Рік тому +1

    Ok, but how do you Delete the saved data?

  • @7darkscythe
    @7darkscythe 2 роки тому

    i can't pick items unless it already in the database

  • @MattRaffel
    @MattRaffel 4 роки тому +3

    Can't you use System.IO.Path.Combine() in place of the string.concat functions and it automatically handles directory (folder) separators for different operating systems? you should also wrap the FileStream with using() so that it automatically handles resource clean up on exceptions.

    • @CodingWithUnity
      @CodingWithUnity 4 роки тому

      Both good ideas, didnt even cross my mind! Thanks!

    • @magictimm4090
      @magictimm4090 4 роки тому +1

      Hi Matt. could you please tell me the line of code? I cannot handle it. FileStream file = System.IO.Path.Combine(Application.persistentDataPath, saveData)); is not correct

    • @leonmulthaupt6430
      @leonmulthaupt6430 2 роки тому

      @@magictimm4090 I *think* he put "using System.IO;" at the top of the InventoryObject.cs with just using a rightclick and a menu and never scrolled up to the beginning of the code so you might have missed it. I only know cause I missed it, too, and typed it in manually.

  • @SineWav0101
    @SineWav0101 3 роки тому +2

    This has been a great tutorial so far but I'm still receiving the KeyNotFoundException error. I've changed the script execution order to ensure the ItemDatabase script's OnAfterDeserialize() callback is called first and added checks to the InventoryObject but still receiving the same error. The ItemDatabase script is simply not recognizing the object key. Any suggestions?

    • @dattoproduction4450
      @dattoproduction4450 3 роки тому

      same.
      have you fixed it yet?

    • @chosenone3
      @chosenone3 3 роки тому

      ​@@dattoproduction4450 @Bryan Lopez
      You must have put the code:
      getId = new Dictionary();
      getItem = new Dictionary();
      for (int i = 0; i < items.Length; i++)
      {
      getId.Add(items[i], i);
      getItem.Add(i, items[i]);
      }
      into the OnBeforeSerialize function instead of OnAfterDeserialize.
      Also, make sure this code:
      for (int i = 0; i < container.Count; i++)
      container[i].item = database.getItem[container[i].id];
      is also in OnAfterDeserialize.

    • @eleocraft278
      @eleocraft278 2 роки тому

      @@chosenone3 Doesn't works, OnBeforeSerialize is not necessarely called before OnAfterDeserialize

  • @toppermcginty5036
    @toppermcginty5036 3 роки тому

    idk if im just tired because its 2am but... i added in the save and load features and I can no longer pick up the items in my game. If this video is still active, someone help?

    • @Big.Rig.
      @Big.Rig. 2 роки тому

      same has happened to me now imm getting dictionary errors

  • @harrison298
    @harrison298 2 роки тому

    Around the middle of this tutorial, I started getting the error message "UnityException: ToString is not allowed to be called during serialization, call it from OnEnable instead."
    Has anyone else figured out how to solve this? I'm unable to build because it won't compile.

    • @DirtBrothers2785
      @DirtBrothers2785 2 роки тому

      i had to add
      public void OnEnable()
      and add all the code under that instead. but i had to leave the other two public void's as well just with nothing in them then the error went away

  • @devononeill8921
    @devononeill8921 3 роки тому

    Awesome video! I'm a bit confused as to why when I save the Items and reload them they show all the same icon, instead of the different variations of the icons, example( i pick up 3 first aids, 3 canned food, 3 water bottles. then i hit space to save, quit, reload, try to load my items and it says i have 3 first aids, 3 first aids, and 3 first aids! it still shows in 3 different columns but the icons all change to the original texture which is the First aid.

    • @Zamoksva
      @Zamoksva 2 роки тому

      samer thing happen to me, it seems heir Id are all 0 but i have no idea why

  • @eleocraft278
    @eleocraft278 2 роки тому +2

    Does not work because the OnAfterSerialize call order is random, sometimes i just get an error because the InventoryObject is trying to access an empty dictionary inside of the ItemDatabaseObject

    • @thieukhai396
      @thieukhai396 2 місяці тому

      Same here. It's always null database because OnAfterSerialize will run before OnEnable.