ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

Creating An Inventory System in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ส.ค. 2024
  • Download Core to create games for FREE at 👉🏻 bit.ly/Core-Ga... and join the Game Creator Challenge 👉🏻 itch.io/jam/gcc - Inventory Systems are a key part of most games, so let's look at how to create one!
    --------------------------------------------------------------------------------
    Want to support the channel?
    ▶️ Help fund new episodes by joining the Patreon - / gamedevguide
    Use these links to grab some cool assets from the asset store:
    Get the Must Have Assets! - assetstore.uni...
    Free Unity Assets! - assetstore.uni...
    New on the Asset Store! - assetstore.uni...
    Top Paid Asset Store Packages - assetstore.uni...
    Asset Store Partners - assetstore.uni...
    --------------------------------------------------------------------------------
    Socials and Other Stuff:
    • Subscribe - www.youtube.co...
    • Join the Discord - / discord
    • Twitter - / gamedevguideyt
    • Facebook - / gamedevguideyt
    • Instagram - / gamedevguideyt

ความคิดเห็น • 289

  • @MrSkyerHawkins
    @MrSkyerHawkins 2 ปีที่แล้ว +281

    I love your video. However, some times I get lost in what code you are talking about since you are only show/talking about one part at a time (which I love because it big and clear, I just not sure which script it belongs too). Could you maybe put the name of the Script in the corner for each time you are showing it?
    Keep up the great work and watching your videos is inspiring!

    • @lorilongwell5451
      @lorilongwell5451 ปีที่แล้ว

      at the top of the scripts it says what the script is

    • @rangesstudio
      @rangesstudio ปีที่แล้ว +4

      @@lorilongwell5451 not always, really got confused with the Update function script that didn't have a name

  • @ben_burnes
    @ben_burnes 2 ปีที่แล้ว +119

    I appreciate that your sponsored content is just that and the tutorial is still pure and not "To do this tutorial, simply buy this sponsored content!" So many channels have fallen into that trap and it ruins the tutorials.

  • @Havie
    @Havie 2 ปีที่แล้ว +17

    Thanks for making this! I had an artist request a way to take screenshots for item icons in Unity a few weeks ago and it was just sitting on the backlog. This worked perfectly and I adapted it to our needs.

  • @lilyofluck371
    @lilyofluck371 2 ปีที่แล้ว +48

    Me watching this for fun know full well that I'm never gonna use this: Hmm interesting... This will be useful... Probably.

    • @HadesMrDark
      @HadesMrDark 2 ปีที่แล้ว

      I did the same for a long time, now i can start a project and mess around a bit with ideas, it can be fun and useful at the same time watching these kind of stuff, just to expand your knowledge and way of thinking, you'll have a starting point if you ever decided to play around with game dev.

  • @GameDevGuide
    @GameDevGuide  2 ปีที่แล้ว +7

    - Download Core to create games for FREE at 👉🏻 bit.ly/Core-GameDevGuide
    - Join the Game Creator Challenge 👉🏻 itch.io/jam/gcc

  • @finnwillow
    @finnwillow 2 ปีที่แล้ว +20

    I have a problem. I am stuck at the Icon Generator [ 4:00 ]bc it just does not work. The tutorial does not show the whole piece of code and I'm a newb and don't know what to do. please help.

    • @christofstanits
      @christofstanits 2 ปีที่แล้ว +27

      using System.Collections;
      using System.Collections.Generic;
      using UnityEditor;
      using UnityEngine;
      public class TakeScreenshot : MonoBehaviour
      {
      Camera cam;
      public string pathFolder;
      public List sceneObjects;
      public List dataObjects;
      private void Awake()
      {
      cam = GetComponent();
      }
      [ContextMenu("Screenshot")]
      private void ProcessScreenshots()
      {
      StartCoroutine(Screenshot());
      }
      private IEnumerator Screenshot()
      {
      for (int i = 0; i < sceneObjects.Count; i++)
      {
      GameObject obj = sceneObjects[i];
      InventoryItemData data = dataObjects[i];
      obj.gameObject.SetActive(true);
      yield return null;
      TakeShot($"{Application.dataPath}/{pathFolder}/{data.id}_Icon.png");
      yield return null;
      obj.gameObject.SetActive(false);
      Sprite s = AssetDatabase.LoadAssetAtPath($"Assets/{pathFolder}/{data.id}_Icon.png");
      if(s!= null)
      {
      data.icon = s;
      EditorUtility.SetDirty(data);
      }
      yield return null;
      }
      }
      public void TakeShot(string fullPath)
      {
      if(cam == null)
      {
      cam = GetComponent();
      }
      RenderTexture rt = new RenderTexture(256, 256, 24);
      cam.targetTexture = rt;
      Texture2D screenShot = new Texture2D(256, 256, TextureFormat.RGBA32, false);
      cam.Render();
      RenderTexture.active = rt;
      screenShot.ReadPixels(new Rect(0, 0, 256, 256 ), 0, 0);
      cam.targetTexture = null;
      RenderTexture.active = null;
      if (Application.isEditor)
      {
      DestroyImmediate(rt);
      }
      else
      {
      Destroy(rt);
      }
      byte[] bytes = screenShot.EncodeToPNG();
      System.IO.File.WriteAllBytes(fullPath, bytes);
      #if UNITY_EDITOR
      AssetDatabase.Refresh();
      #endif
      }
      }

    • @huoguoji1354
      @huoguoji1354 2 ปีที่แล้ว +1

      @@christofstanits hi, i dont know why is keep saving as one sprite any solutions? same code *edit you know what, I'm dumb, I forgot to assign the id

    • @caleeeatcookies8068
      @caleeeatcookies8068 หลายเดือนก่อน +1

      @@christofstanits Thank you so much! This is an absolute life-saver!

  • @KH2FanLover
    @KH2FanLover 2 ปีที่แล้ว +17

    I don't know where you put or create that InventoryItem public class.
    The tutorial is great and compact but the lack of information on where things go is frustrating XD

    • @crazytm8942
      @crazytm8942 2 ปีที่แล้ว

      @Eigulite I didn't (I have the same problem)

    • @archive5500
      @archive5500 2 ปีที่แล้ว +3

      @@crazytm8942 it goes in the script InventorySystem in between void awake and void add.

    • @crazytm8942
      @crazytm8942 2 ปีที่แล้ว +1

      @@archive5500 thank you!

  • @brurrik
    @brurrik 2 ปีที่แล้ว +51

    There's a lot of holes in this tutorial. All of the .current need to be explained. onInventoryChangedEvent and UIInventoryItemSlot aren't explained either

    • @TactfulWaggle
      @TactfulWaggle 2 ปีที่แล้ว +5

      .current is explained in his other video about events, basically go to the top and make put in "public static InventorySystem current;", then go to the private void Awake() and put "current = this;", as for UIInventoryItemSlot i'd like to know myself i'm going crazy over here

    • @encrypteddvjjrxv1857
      @encrypteddvjjrxv1857 2 ปีที่แล้ว +1

      @@TactfulWaggle UIInventoryItemSlot is supposed to be the name of the slot script mentioned a few seconds earlier

    • @TheCatMurgatroyd
      @TheCatMurgatroyd 2 ปีที่แล้ว

      Do you know where "ItemController" comes from!? at 7:40
      I don't have itemController and it doesn't work if I do it with my script that has OnHandlePickupItem in it ;_;

    • @brurrik
      @brurrik 2 ปีที่แล้ว +1

      @@TheCatMurgatroyd No Clue man, I never got around to putting this to work. Just went on and found another tutorial more in depth

    • @TheCatMurgatroyd
      @TheCatMurgatroyd 2 ปีที่แล้ว

      @@brurrik Do you remember which one? I followed another one but was too stupid ;_;

  • @scottisitt
    @scottisitt ปีที่แล้ว +6

    Love the simplicity of the UI! Thank you so much for showing us this!

  • @D3kryption
    @D3kryption 2 ปีที่แล้ว +9

    You're getting sponsers now? Lil Matts growing up! Making us so proud :D nice work buddy!

  • @AgsmaJustAgsma
    @AgsmaJustAgsma 2 ปีที่แล้ว +10

    That screenshot script looks extremely useful and easy to implement. I've been trying to find one that was usable for quite some time.

    • @mohammadsadeghlavaie5560
      @mohammadsadeghlavaie5560 2 ปีที่แล้ว +1

      There's a one-line screenshot method in unity which captures the game view and saves it at the location you pass as a parameter

    • @chikato7106
      @chikato7106 2 ปีที่แล้ว +1

      @@mohammadsadeghlavaie5560 lol did you not watch the video?

  • @bottleofgreed4415
    @bottleofgreed4415 ปีที่แล้ว +15

    Half of the tutorial isn't even showing how to do an inventory system. The video is full of holes and skipped parts

  • @abdelhamedproduction6528
    @abdelhamedproduction6528 2 ปีที่แล้ว +9

    Assets\Scripts\itemobject.cs(11,25): error CS0117: 'InventorySystem' does not contain a definition for 'current' ihave this eror

    • @BANANADOMAU
      @BANANADOMAU 2 ปีที่แล้ว +20

      change your InventorySystem script like this.
      public class InventorySystem : MonoBehaviour
      {
      public static InventorySystem current;
      private Dictionary m_itemDictionary;
      public List inventory;
      private void Awake()
      {
      current = this;
      inventory = new List();
      m_itemDictionary = new Dictionary();
      }

    • @koopee8577
      @koopee8577 2 ปีที่แล้ว

      @@BANANADOMAU which part of the script do I replace this part with

    • @BANANADOMAU
      @BANANADOMAU 2 ปีที่แล้ว +2

      @@koopee8577 just replace some part of the InventorySystem class script
      added this on variable declarations "public static InventorySystem current;"
      added this on Awake method "current = this;"

    • @dragonrager3344
      @dragonrager3344 2 ปีที่แล้ว +1

      @@BANANADOMAU Thank you so much! I've been looking for this SINGLE piece of code forever and couldn't figure it out myself.

    • @GaamerGuyys
      @GaamerGuyys ปีที่แล้ว

      @@BANANADOMAU thank you so much! How'd you figure that out?

  • @burtlangstrom1860
    @burtlangstrom1860 2 ปีที่แล้ว +14

    At what point did you make inventory system a singleton and what is .current? The closest I could find to that is a property in IEnumerator, so is it something you put into the InventorySystem offscreen? Or did you bring something into the class specifically for you to call that?

    • @dygnyc
      @dygnyc 2 ปีที่แล้ว +5

      yeah, there are some hole in the tut.

    • @archive5500
      @archive5500 2 ปีที่แล้ว +8

      yea exactly, like it's a good video except for the fact that there are huge holes in context and he only hearts comments that are positive, these comments go un-replied to and it gets infuriating to a point

    • @5ld734
      @5ld734 2 ปีที่แล้ว +3

      .current is like
      public static InventorySystem current;

    • @DaxVIII
      @DaxVIII ปีที่แล้ว +4

      Maybe its a late answer, but in case anybody searchs for the same thing
      declare a "public static InventorySystem current;" variable inside the InventorySystem script
      and inside the "private void Awake" function instantiate the current variable (currently empty) using : "current = this;" if you do it like he did in the tutorial
      Hope its helpful for any dev wondering in the future

    • @jamesbarancewicz9242
      @jamesbarancewicz9242 9 หลายเดือนก่อน

      @@DaxVIII Veeery new to unity and yes, yes it was helpful. Searched for this for half an hour before coming to the comments here. Thank you

  • @kenansoylu4037
    @kenansoylu4037 2 ปีที่แล้ว +21

    The shown code is missing some important bits like the onInventoryChanged event handler and the InventorySystem singleton instance but overall helpful video.

    • @gedjucius2418
      @gedjucius2418 2 ปีที่แล้ว

      did you solve how to get the on inventorychanged event i cant seem to think of how to do it?

    • @xxragingkillerx8357
      @xxragingkillerx8357 2 ปีที่แล้ว

      @@gedjucius2418 solved yet ??

    • @diogocarloto8464
      @diogocarloto8464 2 ปีที่แล้ว +1

      @@xxragingkillerx8357 just subdcribe to an event that is called every time you change the inventory

    • @dmas7749
      @dmas7749 ปีที่แล้ว +1

      this. i mostly needed to see how to make a menu and it just gets zero attention, annoying.

  • @jacobp.6160
    @jacobp.6160 2 ปีที่แล้ว +6

    To anyone getting "error CS0246: The type or namespace name 'Serializable' could not be found" you just need to add System. Infront first~ "[System.Serializable]"

  • @KingDoogan
    @KingDoogan 2 ปีที่แล้ว +28

    I love how compact your code is.
    This beats watching 10 tutorials to make an inventory lmao
    Really well done and quick

  • @TheCatMurgatroyd
    @TheCatMurgatroyd 2 ปีที่แล้ว +8

    does anyone know what the "itemController" script is!? he shows it at 7:40

  • @Soulzjd2
    @Soulzjd2 2 ปีที่แล้ว +2

    Thanks for the info and the added extra bits too. Like the fact we can use unity to create, and import icons. I had created 40+ icons via copying my entire desktop screen and croping the icon out by hand.

  • @keylon4518
    @keylon4518 2 ปีที่แล้ว +8

    This man did a Core add while doing a unity tutorial

  • @jakehornerman
    @jakehornerman 2 ปีที่แล้ว +11

    Matt please do a series on the new input system, the way you explain concepts and things is so straight forward! would love to see a few videos on this topic

  • @Bagatalion
    @Bagatalion 2 ปีที่แล้ว +19

    Tbh this tutorial is really unclear. The creator uses a singleton, but never explains how it works on a visible example. The viewer has to guess what kind of library the creator is using. A lot of question without answert.
    Not recommended for beginners.

    • @dygnyc
      @dygnyc 2 ปีที่แล้ว

      same. some really good ideas, but some basics glossed over.

    • @IMIv2
      @IMIv2 2 ปีที่แล้ว

      agreed. I ended up going to another tutorial that does things step by step explaining each step instead of: here code good luck.

  • @Markleap
    @Markleap ปีที่แล้ว +6

    i dont see why people cant put the script in description

  • @subirin96
    @subirin96 8 หลายเดือนก่อน +2

    I like how you showcase the system itself. I understood the system itself and it is very good way to create efficient workflow for inventories. However the way you explain codes in sliced screenshot is confusing especially to newer programmers. I hope you can recreate more tutorial for beginners in mind because admittedly most people that watch tutorials are beginner in programming itself. And for advanced user you can make a disclaimer at the star or title itself.

  • @biruna3962
    @biruna3962 2 ปีที่แล้ว +7

    Am I the only one stuck at the screenshot part I've copy the whole code but it doesnt work for me ?

    • @biruna3962
      @biruna3962 2 ปีที่แล้ว +2

      how is camera not deprecated, why targettexture doesnt work ? help pls

  • @Notllamalord
    @Notllamalord 9 หลายเดือนก่อน +1

    the screenshot thing blew my mind ngl

  • @Detrax17172
    @Detrax17172 2 ปีที่แล้ว +3

    Where is the onInventoryChangedEvent and where is the UIInventoryItemSlot? 9:13

  • @Seriphis2200
    @Seriphis2200 2 ปีที่แล้ว +9

    I was having some dramas getting the inventorysystem to serialize, the public getter and private setter in the inventoryitem list definition within the inventorysystem, and then the same for the data and stacksize attributes in the inventoryitem were blocking the serialization... (this is actually seen at 8:03, as there are no attributes when the inventorysystem is added) no messages, nothing. this was on 2020.3.24f1.
    Modifying these lines to remove the getter/setter allowed the serialization as seen at 8:12.
    those playing along at home need simply change "public List inventory {get; private set;}" to "public List inventory;", rince and repeat for the same style of lines in the InventoryItem script.

    • @Seriphis2200
      @Seriphis2200 2 ปีที่แล้ว +2

      I just wanted to circle back as I've learnt another way to solve the problem above; You can forcibly serialize using "[field: SerializeField]" and it achieves the same outcome as removing the getter/setter declaration.

    • @HackEndLess
      @HackEndLess 2 ปีที่แล้ว

      @@Seriphis2200 I did both ways but still can't serialize that list

    • @Seriphis2200
      @Seriphis2200 2 ปีที่แล้ว +1

      ​@@HackEndLess Check that you have your InventoryItem class "[Serializable]", that you've used "[field: serializefield]" on each of the items that have the getters defined in line. In the InventorySystem class you will need to do the same field declaration for the "inventory" list defined within it... you cant serialise the dictionary so if you're expecting that to appear you're out of luck.

    • @HackEndLess
      @HackEndLess 2 ปีที่แล้ว

      ​@@Seriphis2200 I did everything you and others said but still can't serialize inventory list nothing worked for me, I even upgraded Unity version to 2020.3.27f1 from 2020.3.20f1. Anyway thanks for the help. It's not a big deal because system works. So I give up on that.

    • @Seriphis2200
      @Seriphis2200 2 ปีที่แล้ว

      @@HackEndLess Thats a bummer, if its working then great but thats super frustrating. Best of luck with your project.

  • @The3DCubeS
    @The3DCubeS ปีที่แล้ว +6

    In what script is the screenshot function?

  • @RoStepMusic
    @RoStepMusic 2 ปีที่แล้ว +3

    onInventoryChangedEvent was a little tricky for a beginner but I managed to get it working :D

    • @lucidjuice101
      @lucidjuice101 2 ปีที่แล้ว

      Can you please explain how you did it? Thanks in advance :)

    • @RoStepMusic
      @RoStepMusic 2 ปีที่แล้ว +3

      @@lucidjuice101 I followed his other tutorial "how to build an event system"

    • @lucidjuice101
      @lucidjuice101 2 ปีที่แล้ว

      @@RoStepMusic Thanks for the info!

    • @gedjucius2418
      @gedjucius2418 2 ปีที่แล้ว

      @@RoStepMusic i tried to follow that video but still seem to not know to do it

    • @RoStepMusic
      @RoStepMusic 2 ปีที่แล้ว

      @@gedjucius2418 It is not that hard even for a beginner. You should not dive this deep if you don't have basic knowledge. Join his community discord server and ask for help. They will help you in no time.

  • @legosol1081
    @legosol1081 ปีที่แล้ว +4

    I have an issue in my code and can't solve it myself. Thanks for helping in advance...
    Heres this problem... i wrote InventorySystem.current.Add(referenceItem); inside of the item object script, but then unity tells me inventorysystem does not contain a definition for current... how can i solve this?

    • @hi_its_stephen
      @hi_its_stephen 11 หลายเดือนก่อน

      Ah sad.... I commented the exact same question yet I see you asked this 5 months ago with no response

  • @stillzen-dev
    @stillzen-dev 5 หลายเดือนก่อน

    yo, this is such a good video. straight to the point, no bullshit or 50minute expl of each concept

  • @HandsOnKnowledge
    @HandsOnKnowledge 2 ปีที่แล้ว +3

    Thank you Matt for making these videos for us, I have learned a lot from you. Keep making them

  • @camd9886
    @camd9886 2 ปีที่แล้ว +6

    This video is not your best work. Feels very rushed and is honestly a headache to follow.
    Edit: Perhaps include links to the code?

  • @FyresGames
    @FyresGames 2 ปีที่แล้ว +6

    Great work, but I'm a bit lost. I've checked a few times the video and didn't saw when you've added the definition ''current'' in the InventorySystem script and second is there a playlist to show what you did in order before that video?

    • @GameDevGuide
      @GameDevGuide  2 ปีที่แล้ว +1

      As mentioned in the video, I turned it into a singleton. Lookup singletons in C# / Unity for more info.

    • @FyresGames
      @FyresGames 2 ปีที่แล้ว

      @@GameDevGuide Yeah my bad on that part. What about the playlist?

    • @e_series4519
      @e_series4519 2 ปีที่แล้ว +2

      @@GameDevGuide where did you mention it?

    • @updaters44
      @updaters44 2 ปีที่แล้ว +1

      @@GameDevGuide still lost lmao

    • @wmetz1869
      @wmetz1869 ปีที่แล้ว +6

      @@GameDevGuide Dude do you even know how "a tutorial" is work? Not everyone know what the fuck is a singleton, and this kind of scripts need to be completed so it can work.

  • @eggsareliquidchicken5615
    @eggsareliquidchicken5615 2 ปีที่แล้ว +1

    Thanks for the tutorial. I never would have thought of that screenshot method!

  • @Pedro5antos_
    @Pedro5antos_ 2 ปีที่แล้ว +3

    Awesome content!
    A production-ready level of inventory

  • @GameDevExperiments
    @GameDevExperiments 2 ปีที่แล้ว +1

    Great video! I loved how you generated the icons, that was pretty smart :)

  • @deanpaul3635
    @deanpaul3635 2 ปีที่แล้ว +11

    This is really well made and smooth as butter, well done! The icons look cool and a really clever way to capture them, I never thought of that. I've seen similar done in Blender before, but never before in Unity. Thanks for sharing I'm off to to watch more of your videos - great content!

  • @zacharystanaford5466
    @zacharystanaford5466 2 ปีที่แล้ว +2

    I love you made the video for us but the jumping around is confusing me, i don't know where what code belongs?

  • @tahazia6340
    @tahazia6340 2 หลายเดือนก่อน +1

    Its Very Extreme Level Inventory System Very Hard.But Very Helpfull thanks

  • @noobforsoup
    @noobforsoup 2 ปีที่แล้ว +1

    Releasing this just after I struggled making an inventory system... thanks anyway, really useful in improving my own system!

  • @lukeystuff
    @lukeystuff 2 ปีที่แล้ว +2

    Hiya! I managed to make my way through the tutorial fairly easily, but I've just got one problem.
    "onInventoryChangedEvent"
    This doesn't work without other behind the scenes stuff that I don't know right now. Could you help?

    • @GameDevGuide
      @GameDevGuide  2 ปีที่แล้ว

      Check out the event system video here on the channel!

  • @phineasfacingforward3460
    @phineasfacingforward3460 2 ปีที่แล้ว +3

    This is just what I needed! How did you know? Thank you so much

  • @TactfulWaggle
    @TactfulWaggle 2 ปีที่แล้ว +2

    Would be really appreciated if you could tell us what UIInventoryItemSlot is or what it does or how it works, i'm completely stuck over here

  • @FullMe7alJacke7
    @FullMe7alJacke7 ปีที่แล้ว

    Excellent video, super flexible and offers a great starting point for any inventory system.

  • @justinorringer6247
    @justinorringer6247 2 ปีที่แล้ว +4

    Hello! I loved the tutorial. It has really helped our game.
    When generating icons using the universal render pipeline, I can't get the background transparent. I've tried a) different background types b) turning off post-processing c) setting a culling mask d) desperate other changes haha.
    Has anyone else had problems?

    • @trued7461
      @trued7461 2 ปีที่แล้ว

      for me i changed the background type to uninitialized and it worked, make sure youre encoding to png not jpg

  • @mattheweagleman8226
    @mattheweagleman8226 ปีที่แล้ว +2

    Where is he getting "current" from in the line "InventorySystem.current.Add(referenceItem);?

  • @themattbat999
    @themattbat999 2 ปีที่แล้ว

    Just finished my inventory system for my game, but this will help me out a lot in improving it!

  • @mrb1248
    @mrb1248 ปีที่แล้ว +4

    How did you do the screenshotting for the items
    i'm using everything that you showed in the video but i just have a lot of errors
    Did you use another part of the UnityEngine that i haven't?
    just wondering because it would really save a lot of time

    • @quinzelbeck
      @quinzelbeck ปีที่แล้ว

      @Elliott Childs Yhea thats the easy solution, I was thinking in doing that, but where is the fun part of programming? xd (if I cant solve the errors im going to do that)

  • @cossu2821
    @cossu2821 2 ปีที่แล้ว +1

    Alot of holes in this tutorial. Maybe make this part of a series so people are going to know that this tutorial is using other parts from earlier tutorials? Something like " tutorial part x (Inventory system)"? Looks like a general tutorial at first but when you actually start to follow this later in the video you realize it's using alot of stuff from other videos. Learned some new stuff anyways so thanks about that but could have spent my time more productively if i would have known this beforehand!

  • @GammingPotato
    @GammingPotato ปีที่แล้ว +1

    The screenshot script didn't work for me :(

  • @Makzimoto
    @Makzimoto 2 ปีที่แล้ว +2

    so... basicaly... the postman broke into your house and will not leave until you rob the house yourself and give the items to the postman... 100IQ postman right there

  • @talismanskulls2857
    @talismanskulls2857 2 ปีที่แล้ว +9

    Not very helpful leaving all the holes in everything.

  • @AetherXIV
    @AetherXIV 2 ปีที่แล้ว +3

    I feel like this video only helps people as smart as you...

    • @rayne9323
      @rayne9323 ปีที่แล้ว

      He is leaving things out intentionally so that you can go watch his other videos about the parts left out.

  • @KBforJesusChrist
    @KBforJesusChrist ปีที่แล้ว +1

    Please make a complete tutorial on shop system for abilities, weapons and characters please no one is talking about this I'm stuck i want a start menu shop system where you buy and select items you will use in match in another scene please 🥺

  • @nicolasyanezsilva753
    @nicolasyanezsilva753 2 ปีที่แล้ว +2

    I can't seem to be able to see the Inventory list in the inspector, if I don't put the private set I can only see it as an element, but it doesn't display with all its properties for some reason

    • @TVBUDDHAS
      @TVBUDDHAS 2 ปีที่แล้ว +1

      remove the {get set} from both the InventorySystem and the InventoryItem scripts :)

    • @joshuahoem8740
      @joshuahoem8740 2 ปีที่แล้ว

      @@TVBUDDHAS Thank you- this helped! Why is that?

  • @stiffnasty3364
    @stiffnasty3364 2 ปีที่แล้ว +2

    The timing of this video is impeccable! Love your videos, thank you!

  • @anceaaa
    @anceaaa 2 ปีที่แล้ว +3

    Bro if you have to do a tutorial at least show full stuff not incomplete scripts for beginners like someone in this comments

  • @strategy2128
    @strategy2128 2 ปีที่แล้ว +1

    It was an awesome tutorial! Especially the screenshot system was amazing. Now to figure out how the letter is going to get to the postman when the postman has to deliver it ;)

    • @TVBUDDHAS
      @TVBUDDHAS 2 ปีที่แล้ว

      did you figure out how to use the items once they're in your inventory?

  • @mattias9273
    @mattias9273 2 ปีที่แล้ว

    This came exactly when i needed it
    Thanks! :D

  • @krissloo143
    @krissloo143 2 ปีที่แล้ว

    I enjoyed watching this a lot! Well done

  • @HappyBell92
    @HappyBell92 ปีที่แล้ว +3

    Okay WTF, You are not even showing the full script for the Icon Generator only the function. as a beginner this is very hard to follow. Do we need a private Camera camera; variable? what more variables do we need if any? Like how do I set the prefix and Path Folder

  • @brixtonbuskers
    @brixtonbuskers 9 หลายเดือนก่อน

    Great tutorial. Very small but I think you forget to add to the stack when new inventory is added but is not already within the dictionary (at 6.37). I also don't really understand why you separate out InventoryItemData and InventoryItem. I know people can be averse to putting behaviour on scriptable objects but it seems cleaner / simpler to me to consolidate all the data about the inventory item in one place.

  • @RandomProduct
    @RandomProduct 2 ปีที่แล้ว +2

    First. Where's my Patreon fam at?

  • @MangoVoxel
    @MangoVoxel 2 ปีที่แล้ว +2

    I got lost at 4:00 because it only shows a snippet of code - I am new to unity so trying to figure this out was really difficult, is there a place where I can see the full IconGenerator code?

    • @greenlandmods
      @greenlandmods 2 ปีที่แล้ว

      Same I wish he would show the whole thing

    • @aleks_gavs
      @aleks_gavs ปีที่แล้ว +6

      using System.Collections;
      using System.Collections.Generic;
      using UnityEditor;
      using UnityEngine;
      public class TakeScreenshot : MonoBehaviour
      {
      Camera cam;
      public string pathFolder;

      public List sceneObjects;
      public List dataObjects;
      private void Awake()
      {
      cam = GetComponent();
      }
      [ContextMenu("Screenshot")]
      private void ProcessScreenshots()
      {
      StartCoroutine(Screenshot());
      }
      private IEnumerator Screenshot()
      {
      for (int i = 0; i < sceneObjects.Count; i++)
      {
      GameObject obj = sceneObjects[i];
      InventoryItemData data = dataObjects[i];
      obj.gameObject.SetActive(true);
      yield return null;
      TakeShot($"{Application.dataPath}/{pathFolder}/{data.id}_Icon.png");
      yield return null;
      obj.gameObject.SetActive(false);
      Sprite s = AssetDatabase.LoadAssetAtPath($"Assets/{pathFolder}/{data.id}_Icon.png");
      if(s!= null)
      {
      data.icon = s;
      EditorUtility.SetDirty(data);
      }
      yield return null;
      }
      }
      public void TakeShot(string fullPath)
      {
      if(cam == null)
      {
      cam = GetComponent();
      }
      RenderTexture rt = new RenderTexture(256, 256, 24);
      cam.targetTexture = rt;
      Texture2D screenShot = new Texture2D(256, 256, TextureFormat.RGBA32, false);
      cam.Render();
      RenderTexture.active = rt;
      screenShot.ReadPixels(new Rect(0, 0, 256, 256 ), 0, 0);
      cam.targetTexture = null;
      RenderTexture.active = null;
      if (Application.isEditor)
      {
      DestroyImmediate(rt);
      }
      else
      {
      Destroy(rt);
      }
      byte[] bytes = screenShot.EncodeToPNG();
      System.IO.File.WriteAllBytes(fullPath, bytes);
      #if UNITY_EDITOR
      AssetDatabase.Refresh();
      #endif
      }
      }

    • @TheJakeblake
      @TheJakeblake ปีที่แล้ว

      @@aleks_gavs Thank you sooo much!

    • @aleks_gavs
      @aleks_gavs ปีที่แล้ว +1

      @@TheJakeblake I copied it from another comment)

    • @TheJakeblake
      @TheJakeblake ปีที่แล้ว +2

      @@aleks_gavs oh for real? I did not found that comment, thanks none the less, your comment is much more to the top I assume so this saves me time, which I'm glad, Have a Good Day.

  • @GiraPrimal
    @GiraPrimal 2 ปีที่แล้ว +1

    I’m working on an inventory system and boom, this tutorial pops up.
    Coincidence? I think not ;)

  • @Ultratermin8or
    @Ultratermin8or 2 ปีที่แล้ว +2

    Where did you declare the "current" variable in the InventorySystem class???? Edit: I figured out how to do it in my own way. Damn I love how you get a lot of information out in a short amount of time, but you didn't show all the code you were using so I had to actually use my lazy comp sci brain to fill in the gaps.

    • @mashedpotatonl7966
      @mashedpotatonl7966 2 ปีที่แล้ว

      How did you fix it? Stuck there now :P

    • @Ultratermin8or
      @Ultratermin8or 2 ปีที่แล้ว

      @@mashedpotatonl7966 I haven't implemented full thing yet but I just created an inventory system item in my interactable class and just did inventorySystem.inventory.add(referenceItem)

  • @thebulletkin8393
    @thebulletkin8393 7 หลายเดือนก่อน

    With these scriptable objects, it looks to me like they are best used when you have an item that doesn't change its state at all, since it just references the asset. But if you want to create an inventory system like say, Minecraft, whereby using an item reduces its durability, can SOs allow for individual changes in these items?

  • @thepreps6124
    @thepreps6124 2 ปีที่แล้ว

    Posted 1 day ago! Great to see

  • @thatboi6176
    @thatboi6176 2 ปีที่แล้ว

    I realized your tactics are beyond my knowledge.

  • @chinapoop
    @chinapoop 2 ปีที่แล้ว +1

    Pls make a tutorial series of making a open world game

  • @darcking99
    @darcking99 ปีที่แล้ว

    In this example, I think you set a reference to the corresponding Scriptable Object in each Item prefab, correct?

  • @antonkobziev405
    @antonkobziev405 2 ปีที่แล้ว

    thank you for this amazing tutorial

  • @raniem4368
    @raniem4368 2 ปีที่แล้ว +1

    At 8:13 how did you manage to view the inventory in the inspector?
    I didnt think Unity would show public list's in the inspector.

    • @huoguoji1354
      @huoguoji1354 2 ปีที่แล้ว +1

      two ways, one way just set the list to serializable, second way just use debug mode

    • @raniem4368
      @raniem4368 2 ปีที่แล้ว

      @@huoguoji1354 I did set the list to serializable, but that did not make it show up.

    • @huoguoji1354
      @huoguoji1354 2 ปีที่แล้ว +1

      @@raniem4368 maybe use the debug mode method, that usually works

    • @huoguoji1354
      @huoguoji1354 2 ปีที่แล้ว +1

      @@raniem4368 the debug work for me

    • @raniem4368
      @raniem4368 2 ปีที่แล้ว +1

      @@huoguoji1354 awesome. Thanks

  • @epicdragon668
    @epicdragon668 2 ปีที่แล้ว +2

    do you have to use the screenshot script to make the icons?

  • @Hyphen3372
    @Hyphen3372 ปีที่แล้ว +1

    I really wish gdg would just make a github repo for this
    there are so many things not working

  • @trueblue97
    @trueblue97 2 ปีที่แล้ว +1

    Hey pretty random but any chance you could make a tutorial on placing Unity UI elements beneath each other. I am trying to make some buttons under scrolling text that chages size.
    I keep thinking I should be able to set the buttons to say layout below text, kind of like in android studio, but I see no such feature in unity.
    Thanks for any help!

  • @flathead9134
    @flathead9134 2 ปีที่แล้ว +2

    How to create Screenshot button like in video at 4:14 ?

    • @josequeiros4811
      @josequeiros4811 2 ปีที่แล้ว

      I can't create it either. Can anyone help?

    • @HausCoding
      @HausCoding 2 ปีที่แล้ว

      [ContextMenu("Screenshot")] in video at 4:46

  • @justbake7239
    @justbake7239 2 ปีที่แล้ว +2

    Could you make a video about saving the inventory? I really enjoyed this video but found that this is the only thing missing.

    • @GameDevGuide
      @GameDevGuide  2 ปีที่แล้ว +7

      I actually have a save system video on the channel. You should be able to extrapolate that to save your inventory!

  • @N19252
    @N19252 2 ปีที่แล้ว +2

    Guid on Unity and sponsored by Core made on Unreal 👀

  • @KaanErayAKAY
    @KaanErayAKAY 2 ปีที่แล้ว +1

    Can u do video about quest system with scriptable object?

  • @Eculeus007
    @Eculeus007 2 ปีที่แล้ว

    The EnforcePresetPostProcessor Script have 2 errors by me.
    AssetDatabase' does not contain a definition for 'RegisterCustomDependency'
    Assets\Editor\EnforcePresetPostProcessor.cs(68,24): error CS1061: 'AssetImportContext' does not contain a definition for 'DependsOnArtifact' and no accessible extension method 'DependsOnArtifact' accepting a first argument of type 'AssetImportContext' could be found (are you missing a using directive or an assembly reference?)

  • @user-bc5kb1pk8x
    @user-bc5kb1pk8x 2 ปีที่แล้ว

    Ur amazing omg this is the right place to find a genius developer with useful and pro content, but can we get a haptic feedback vid?

  • @Niksstuff
    @Niksstuff 2 ปีที่แล้ว +1

    Amazing tutorial! My only issue was that the InventorySystem.current didnt work, there is no refference to something called "current" could anyone please help? Thanks

    • @alexiserussard2956
      @alexiserussard2956 2 ปีที่แล้ว

      You need to create a singleton with the inventory script

    • @_Business.Guide_
      @_Business.Guide_ 2 ปีที่แล้ว

      hey yea i have a same error like @Niksstuff so' how can i do it? @AleyisErussard

    • @alexiserussard2956
      @alexiserussard2956 2 ปีที่แล้ว

      @@_Business.Guide_ I've said it, you need to create a singleton

    • @nomatyx5789
      @nomatyx5789 2 หลายเดือนก่อน +1

      This part was very glossed over, so I'll explain. A singleton is a kind of static object, which can be accessed from any script. To do that, you'll have to instantiate an instance of the singleton.
      Googling what "current" means in unity will only bring you to the one regarding Events, which isn't accurate. For my singletons, I use the name instance. So, at the top of the InventorySystem script, you should write:
      private static InventorySystem _instance;
      public static InventorySystem Instance => _instance;
      Then, inside your awake function (create one if you don't have one!), write some code that makes sure there is ONLY ONE instance of the singleton:
      if (_instance != null) {
      Debug.Log("there's already an instance of this singleton!")
      Destroy(_instance);
      return;
      }
      _instance = this;
      Now, when implementing this code, replace "current" with Instance when it's outside of the InventorySystem script, and _instance when it's inside.

  • @josephwilkinson977
    @josephwilkinson977 6 หลายเดือนก่อน

    In InventorySystem, the [Serializable] line is giving me errors and nothing I change fixes it.

    • @Epic_Backflip
      @Epic_Backflip 5 หลายเดือนก่อน

      Try adding "using System;" to the top.

  • @hi_its_stephen
    @hi_its_stephen 11 หลายเดือนก่อน +1

    I got an error for the ItemObject script at 7:50. It says 'Inventory System' does not contain a definition for 'current.' In theory, I understand what a singleton is, but I feel like this section was glossed over quickly. I'm inexperienced and thus missing something that should probably be really obvious.

    • @nomatyx5789
      @nomatyx5789 9 หลายเดือนก่อน +2

      A singleton is an object that can be accessed from any script. To do that, you'll have to instantiate an instance of the singleton. Write some code that makes sure there is ONLY ONE instance of the singleton.
      Googling what "current" means in unity will only bring you to the one regarding Events, which isn't accurate. for my singletons, I use the name instance. So, at the top of the InventorySystem script, you should write:
      private static InventorySystem _instance;
      public static InventorySystem Instance => _instance;
      Then, inside your awake function (create one if you don't have one!), write:
      if (_instance != null)
      {
      Debug.Log("there's already an instance of this singleton!")
      Destroy(_instance);
      return;
      }
      _instance = this;
      Now, when implementing this code, replace "current" with Instance when it's outside of the InventorySystem script, and _instance when it's inside.

    • @kalashio
      @kalashio 2 หลายเดือนก่อน

      @@nomatyx5789 Thank you so much, actually amazing

    • @nomatyx5789
      @nomatyx5789 2 หลายเดือนก่อน

      @@kalashio Sorry, could you remind me what my comment said? It seems to not be showing up for me

    • @kalashio
      @kalashio 2 หลายเดือนก่อน

      @@nomatyx5789yeah no worries! You explained what singletons were and gave code on how to properly implement the system into the game. (Which worked perfectly)

    • @nomatyx5789
      @nomatyx5789 2 หลายเดือนก่อน

      @@kalashio awesome :) glad i could help!
      i went on some comment retrieval site and found my comment-- there's one thing i'd like to clear up. All static variables are able to be accessed by the whole program. Singletons are just a certain type of static variable.
      The difference between a singleton and a static variable is the "if(_instance != null){Destroy(_instance);} bit. That's essentially saying "there can only be one instance of this", which is important for things like an inventory where you only want one

  • @sinatrocious
    @sinatrocious 2 ปีที่แล้ว

    InventoryItemData contains prefab field and then each item prefab should contain ItemObject component with referenceItem pointing on corresponding inventory item ScriptableObject.. huh? What is the purpose of this circular dependency? Is it to make it easy to drop item (move it from inventory into the world)? But how about spawning item (e.g. to randomize initial stamp positions) or adding it into inventory (deserializing)?

  • @daberechiukoha-kalu356
    @daberechiukoha-kalu356 2 ปีที่แล้ว +1

    Hi, is it possible to get some help with getting the UI for inventory to work with my code? I was getting a bunch of errors and they were from missing gaps of code which I've fixed but for some reason the UI doesn't seem to be working still. I'm no longer getting errors but it doesn't add or remove the image icons when I pickup items

    • @officialsteve2185
      @officialsteve2185 ปีที่แล้ว

      Im in the same place. Any info on this would be great.

  • @Devil_Tech
    @Devil_Tech ปีที่แล้ว

    Great tutorial!

  • @ThomasChen-ur2gt
    @ThomasChen-ur2gt 2 ปีที่แล้ว

    can you do a video about how to design and build an xml importer for items and missions?

  • @benniegant1603
    @benniegant1603 2 ปีที่แล้ว

    Many Many Many Many Thanks -- Awesome!

  • @JarppaGuru
    @JarppaGuru ปีที่แล้ว +1

    3:59 Dont we hate tutorials when full script not showed. it wont work without adding needed things.
    how i get button to click screen shot or that menu LOL

  • @nautisshadrick9254
    @nautisshadrick9254 2 ปีที่แล้ว

    Everytime I try and use the handle function in the itemObject it adds an empty slot to the list

  • @TheSpiritBolt
    @TheSpiritBolt 2 ปีที่แล้ว +8

    This is not beginnner friendly.

    • @GameDevGuide
      @GameDevGuide  2 ปีที่แล้ว +1

      Nope and that's by design!
      Most of the way I approach content here is just me teaching something to another, slightly less experienced, version of myself. 😂 And I fully expect most people watching to be at a similar point.
      This is because there are plenty of other incredibly talented creators here on TH-cam for beginners. 👌🏻 So I don't need to be competing in that space, nor do I want to.
      Thanks for watching though, hopefully you'll find the channel more useful later in your gamedev journey!

    • @EarthMoonStar
      @EarthMoonStar 2 ปีที่แล้ว +1

      ​@@GameDevGuide Explaining this before the tutorial starts is important! Many people looking for this type of tutorial are beginners. I gave up after 7 minutes. 7:40 That part of the video is very confuse! I just wasted my time.

  • @forecastumbrella1626
    @forecastumbrella1626 8 หลายเดือนก่อน +3

    Sorry, but the way you present the code is very confusing resulting in a bad tutorial. Some of it is shown as bits, some of it comes in the wrong order, some like the "itemContoller" we're never even shown. I would say this definitely for advanced users who can fill the gaps themselves which renders the tutorial useless in the first place.

  • @ArisKimi
    @ArisKimi 2 ปีที่แล้ว

    Thanks for the tutorial. It's quite easy to understand once you know where and what

  • @boo1760
    @boo1760 13 วันที่ผ่านมา

    are these scripts uploaded anywhere? the video goes fast and is quite sporadic, and im a programmer lol

  • @squffed
    @squffed ปีที่แล้ว

    this is pretty poggers!

  • @aussieraver7182
    @aussieraver7182 2 ปีที่แล้ว

    8:23
    Game UI Database
    Also, thanks for the tutorial!