{"id":2393,"date":"2025-11-17T20:50:05","date_gmt":"2025-11-17T20:50:05","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2393"},"modified":"2025-11-26T18:55:13","modified_gmt":"2025-11-26T18:55:13","password":"","slug":"inventory-manager","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/inventory-manager\/","title":{"rendered":"Inventory Manager"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>This component handles the Global Storage Solution and also the inventory UI. This is also a required component for the system to work, so one must be placed under a Canvas. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Setting up<\/h2>\n\n\n\n<p>There is a prefab Inventory_UI located in \/prefabs\/UI.<br><br>Setting up without the prefab otherwise is a little more complicated, as it would involve creating all the working parts of the inventory. The two main working parts are the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-item-slot\/\" title=\"Inventory Item Slot\">InventoryItemSlots<\/a> and the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount-info-panel\/\" title=\"Item Amount Info Panel\">ItemAmountInfoPanel<\/a>. <br><br>You can find prefabs for the two individual components in \/prefabs\/UI called InventorySlots and ItemAmountInfoPanel. If you decide you do not want slots or the ItemAmountInfoPanel then you do not need to have them. The only required part is this component itself. <br><br>This component should be placed under a Canvas.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Global Storage Solution<\/h2>\n\n\n\n<p>Think of this as a sorting depot, it recieves the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmounts<\/a> it needs to store, and then figures out which <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a> it should be placed in based on the chosen settings. <br><br>All <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainers<\/a> by default are set to be included in this solution, but on <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a> there is an option for &#8216;Include In Global Inventory&#8217; which is enabled by default. By disabling this, the Inventory will not use this <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Settings<\/h2>\n\n\n\n<p><strong>All Items<\/strong><br>All <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> Scriptable Objects should be added into this List to ensure correct Item finding.<br><br><strong>Selection Method<\/strong><br>There are 4 methods, each will order the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainers<\/a> based on these and return the best fit for the Selection Method chosen.<br><br>Priority &#8211; On each ItemContainer there is a &#8216;Priority&#8217; setting. Selection will pick higher numbers first. So if you had for example a specific <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a> that needed filling first, you could given that Priority 10, while the others could just be the default value. <br><br>Distance &#8211; Selection is made based on where the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmount<\/a> has come from (<a href=\"https:\/\/golemitegames.com\/index.php\/docs\/resource-node\/\" title=\"Resource Node\">ResourceNode<\/a> or <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/crafter\/\" title=\"Crafter\">Crafter<\/a> transform) to the nearest <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a>. <br><br>Random &#8211; Selection is made completly randomly.<br><br>Default &#8211; You can assign some default containers, and selection will simply go through this list in order of the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainers<\/a> in the list. <br><br><strong>Default Containers<\/strong><br>The default containers to use for the Default Selection Method.<br><br><strong>Display Type<\/strong><br>This describes how the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmounts<\/a> are displayed in the Inventory UI panels. <br><br>Consolidated &#8211; All <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmounts<\/a> will appear in the same stack. For example, if you had 5 x Log in one <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">ItemContainer<\/a> and 7 x Log in another, then the Inventory UI would simply show 1 <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-item-slot\/\" title=\"Inventory Item Slot\">InventoryItemSlot<\/a> with 12 x Log.<br><br>Item Stack Size &#8211; All <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmounts<\/a> are broken up into there respective stack sizes. Using the example above &#8211; If Log had a stack size of 5, you would see 3 <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-item-slot\/\" title=\"Inventory Item Slot\">InventoryItemSlot&#8217;s<\/a> with 2 of them containing 5, and the other containing 2. <br><br><strong>Inventory Panel<\/strong><br>Assign the Inventory Panel to open and close when Inventory Input is triggered. <br><br><strong>Item Amount Info Panel<\/strong><br>Assign the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount-info-panel\/\" title=\"Item Amount Info Panel\">ItemAmountInfoPanel<\/a> gameobject. This is basically the ItemAmount info screen. On here you can see various things like amount, value, stack size, and also the option to sell the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmount<\/a> via a slider. <br><br><strong>Slots<\/strong><br>These are the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-item-slot\/\" title=\"Inventory Item Slot\">InventoryItemSlots<\/a> needed to display the UI <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmounts<\/a> in the Inventory Panel. You should assign a reasonable amount to never run out of slots. (Make enough for your max inventory size).<br><br><strong>Close Btn<\/strong><br>The Button component to assign to close the Inventory UI window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Event<\/h2>\n\n\n\n<p><strong>Sell Item Amount Event<\/strong><br>Triggers when an <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">ItemAmount<\/a> is sold via the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount-info-panel\/\" title=\"Item Amount Info Panel\">Item Amount Info Panel<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Scripting<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\" data-show-lang=\"0\"><code>\/\/Action\n\n\/\/Triggers when an ItemAmount is sold via the Item Amount Info Panel\npublic Action&lt;double&gt; SellItemAmountAction;\n\n\/\/Example \npublic void Start \n{\n    Inventory.Instance.SellItemAmountAction += (currency) =&gt; AddToPlayerMoney(currency);\n}\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Return the Item Scriptable Object from a given ID\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;id&quot;&gt;The ID of the Item&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;The Item Scriptable Object&lt;\/returns&gt;\npublic Item GetItemByID(int id)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Stores an ItemAmount across all available containers based on Selection Method\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to store&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;sourcePosition&quot;&gt;The position of where the ItemAmount came from - best used with the Distance Selection Method&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;The remainder not stored, 0 if fully stored&lt;\/returns&gt;\npublic double AddItem(ItemAmount itemAmount, Vector3? sourcePosition = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Removes an ItemAmount across all available containers based on Selection Method\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to remove&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;sourcePosition&quot;&gt;The position of where the ItemAmount is - best used with the Distance Selection Method&lt;\/param&gt;\npublic void RemoveItem(ItemAmount itemAmount, Vector3? sourcePosition = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Registers an ItemContainers to be used by the Inventory Manager\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemContainer&quot;&gt;The ItemContainer to register&lt;\/param&gt;\npublic void RegisterItemContainer(ItemContainer itemContainer)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Removes an ItemContainer from the Inventory Manager list\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemContainer&quot;&gt;The ItemContainer to remove&lt;\/param&gt;\npublic void UnRegisterItemContainer(ItemContainer itemContainer)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get a List&lt;ItemAmount&gt; of all stored ItemAmounts in all ItemContainers that are registered\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemContainer&quot;&gt;The ItemContainer that will be checked if specified&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;The ItemAmount List of all ItemContainers&lt;\/returns&gt;\npublic List&lt;ItemAmount&gt; GetAllStoredItemsList(ItemContainer itemContainer = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get a Dictionary&lt;Item, double&gt; of all stored Items and there amounts in all ItemContainers that are registered\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;returns&gt;A dictionary containing all owned Items and there amounts&lt;\/returns&gt;\npublic Dictionary&lt;Item, double&gt; GetAllStoredItemsDictionary()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get a Dictionary&lt;Item, double&gt; of all stored Items and there amounts in a specified ItemContainer\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemContainer&quot;&gt;The ItemContainer that will be checked&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;A dictionary containing Items and there amounts in the given ItemContainer&lt;\/returns&gt;\npublic Dictionary&lt;Item, double&gt; GetAllStoredItemsDictionary(ItemContainer itemContainer)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Do all of the registered ItemContainers contain at least or more of each of the blueprint materials\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;blueprint&quot;&gt;The blueprint for which the materials are checked against&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;Whether the Inventory System has enough materials for the blueprint&lt;\/returns&gt;\npublic bool CanFulfillMaterials(Blueprint blueprint)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Removes all materials using the Inventory Manager storage system based on the Selection Method\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;blueprint&quot;&gt;The blueprint for which the materials are checked against&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;sourcePosition&quot;&gt;The position of where the blueprint came from - best used with the Distance Selection Method&lt;\/param&gt;\npublic void TakeMaterials(Blueprint blueprint, Vector3? sourcePosition = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get an ItemContainer can that store ALL of the given ItemAmount\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to be stored&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;sourcePosition&quot;&gt;The position of where the ItemAmount came from - best used with the Distance Selection Method&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;The ItemContainer that can store the ItemAmount, returns null if none are possible&lt;\/returns&gt;\npublic ItemContainer GetStorableItemContainer(ItemAmount itemAmount, Vector3? sourcePosition = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Sell an ItemAmount and trigger the SellItemAmountAction&lt;double&gt; - Hook into this to return the sold value - Currency = itemAmount.amount * itemAmount.item._value\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to sell&lt;\/param&gt;\npublic void SellItemAmount(ItemAmount itemAmount)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Open the Item Amount Info Panel with the given InventoryItemSlot\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;inventoryItemSlot&quot;&gt;The InventoryItemSlot to use to display&lt;\/param&gt;\npublic void OpenItemAmountInfoPanel(InventoryItemSlot inventoryItemSlot)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Refresh the Inventory without any parameters\n\/\/\/ &lt;\/summary&gt;\npublic void RefreshUIGlobal()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Update the Inventory UI display based on the Display Type\n\/\/\/ &lt;\/summary&gt;\npublic void RefreshInventoryUI(ItemContainer itemContainer = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Open or close the Inventory panel\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;visible&quot;&gt;&lt;\/param&gt;\npublic void SetInventoryPanelVisible(bool visible)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Is the Inventory open\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;returns&gt;true for open&lt;\/returns&gt;\npublic bool IsInventoryOpen()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Toggle the Inventory panel depending on its current active state\n\/\/\/ &lt;\/summary&gt;\npublic void ToggleInventoryPanelVisible()<\/code><\/pre><\/div>\n\n\n\n<p><br><br><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This component handles the Global Storage Solution and also the inventory UI. This is also a required component for the system to work, so one must be placed under a Canvas. Setting up There is a prefab Inventory_UI located in \/prefabs\/UI. Setting up without the prefab otherwise is a little more complicated, as it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"doc_category":[46],"doc_tag":[],"class_list":["post-2393","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":1421,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"rickitz5h","author_nicename":"rickitz5h","author_url":"https:\/\/golemitegames.com\/index.php\/author\/rickitz5h\/"},"doc_category_info":[{"term_name":"Resource And Production","term_url":"https:\/\/golemitegames.com\/index.php\/docs-category\/resource-and-production\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/comments?post=2393"}],"version-history":[{"count":9,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2393\/revisions"}],"predecessor-version":[{"id":2586,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2393\/revisions\/2586"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2393"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2393"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}