{"id":2196,"date":"2025-11-11T22:57:21","date_gmt":"2025-11-11T22:57:21","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2196"},"modified":"2025-11-20T21:58:46","modified_gmt":"2025-11-20T21:58:46","password":"","slug":"item-container","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/","title":{"rendered":"Item Container"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>Item Containers are the flexible storage solution linking up to the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-manager\/\" title=\"Inventory Manager\">Inventory Manager<\/a> as a Global Storage solution if required. <br><br>They can be used singularly, or used in this combined method.<\/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 for the Item Container located in \/Prefabs\/ItemContainer_Master.<\/p>\n\n\n\n<p>If you wanted to set up from scratch, a couple of things to remember &#8211; <br>The parent should contain the Item Container component, with the Mesh with Collider (3d or 2d) attached as a child. Any other components you wish to add to the Item Container such as a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/stat-bar\/\" title=\"Stat Bar\">StatBar<\/a> for the Overall Capacity or a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup-spawner\/\" title=\"Popup Spawner\">Popup Spawner<\/a> should also be children of the Item Container gameobject.<br>It should look something like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"315\" height=\"80\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-10.png\" alt=\"\" class=\"wp-image-2262\" style=\"width:240px;height:61px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-10.png 315w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-10-300x76.png 300w\" sizes=\"(max-width: 315px) 100vw, 315px\" \/><\/figure>\n\n\n\n<p>Everything else is free to explore, and is best to try out which settings work for your game &#8211; see below for what each setting does. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Settings<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"700\" height=\"627\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-11.png\" alt=\"\" class=\"wp-image-2265\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-11.png 700w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-11-300x269.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p><strong>Storage Type<\/strong><br>All &#8211; Stores every type of <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> available<\/p>\n\n\n\n<p>ByType &#8211; Stores only the Items listed in Specific Item Types List. These will then be displayed as an icon above the Item Container. <\/p>\n\n\n\n<p><strong>Overall Container Limit Stat<\/strong><br>The overall capacity of the container. This Sums all Item Amounts, to check against this Limit. <br><br><strong>Stack Count Limit<\/strong> <strong>Stat<\/strong><br>The Stack capacity of the container. If Items have a stack size set, then after that stack has reached its limit, then a new stack is created. The total stacks are checked against this Limit. You can think of stacks as slots in a container.<br>See below the two stacks, as the Log <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> has a stack size of 10.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"697\" height=\"171\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-12.png\" alt=\"\" class=\"wp-image-2268\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-12.png 697w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-12-300x74.png 300w\" sizes=\"(max-width: 697px) 100vw, 697px\" \/><\/figure>\n\n\n\n<p><strong>Include In Global Inventory<\/strong><br>If true, this Item Container will be part of Global Storage solution provided by the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-manager\/\" title=\"Inventory Manager\">Inventory Manager<\/a>. <br>If false, this Item Container will act independently.<\/p>\n\n\n\n<p><strong>Priority<\/strong><br>Priority will change which Item Container is chosen by the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/inventory-manager\/\" title=\"Inventory Manager\">Inventory Manager<\/a> during the selection in the Global Storage solution. Highest available is picked first. <br><br><strong>Interact Behaviour<\/strong><br>Click &#8211; Opens the Inventory window with only the Item Amounts in this Item Container.<\/p>\n\n\n\n<p>Disabled &#8211; No interaction will occur with this Item Container.<br><br><strong>Item Amounts <\/strong><br>This is the List of Item Amounts this Item Container is currently holding, split into stacks if applicable. <br>Note &#8211; This is generally meant for testing as it kept public, you can add things to this list in the inspector, and it will refresh on Start as long as the game is not loaded. If the game is loaded, everying put in from the inspector will be overwritten. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"699\" height=\"285\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-13.png\" alt=\"\" class=\"wp-image-2270\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-13.png 699w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-13-300x122.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Events<br><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"702\" height=\"660\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-14.png\" alt=\"\" class=\"wp-image-2271\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-14.png 702w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-14-300x282.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/figure>\n\n\n\n<p>As with most of the core systems, there are key events you can hook into either via the editor, or via code. <br><br><strong>On Item Amounts Changed Event<\/strong><br>Triggers whenever there are any changes in the Item Container, whether added, or removed. <br><br><strong>On Item Amount Add Event<\/strong><br>Triggers when an <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">Item Amount<\/a> is added.<br><br><strong>On Item Amount Remove Event<\/strong><br>Triggers when an <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">Item Amount<\/a> is removed.<br><br><strong>On Hit Overall Limit Event<\/strong><br>Triggers when Overall Limit Stat is reached. <br><br><strong><strong>On Stack Limit Event<\/strong><br><\/strong>Triggers when Stack Limit Stat is reached.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Saving and Loading<\/h2>\n\n\n\n<p>All Item Containers that need saving must have the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/saveable-object\/\" title=\"Saveable Object\">Saveable Object<\/a> component added to it, which in turn will add a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/unique-id\/\" title=\"Unique ID\">Unique ID<\/a> component.<br>Check <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/save-manager\/\" title=\"Save Manager\">SaveManager<\/a> to see how to do custom save and load back into your scene.<\/p>\n\n\n\n<p>Only one list is saved for Item Containers, the ItemStackData list. This contains the itemID and the amount of the item stored. Any Item Containers placed during runtime ARE saved however because this asset does not do any building logic, you would need to first of all build this asset back into the world &#8211; then get its save data (see this section for more details on how to do this) and then finally reinstate the Item Container as saved.  <\/p>\n\n\n\n<p>Loading is fairly straght forward and will load the Item Amounts list exactly as saved. Destroyed Item Containers before saving will be completly reinstated if they were placed in the editor. As the asset has nothing to do with building &#8211; all destroyed Item Containers should be dealt with in how you define your placement\/removal\/loading logic. If placed in the editor, your loading logic could remove the gameobject if it was destroyed. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Extras<\/h2>\n\n\n\n<p>There are some nice complementary components for Item Container, such as the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/event-visual\/\" title=\"Event Visual\">Event Visual<\/a>, <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup-spawner\/\" title=\"Popup Spawner\">Popup Spawner<\/a>, <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/ui-billboard\/\" title=\"UI Billboard\">Stat Bar<\/a> and <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/info-icon\/\" title=\"Info Icon\">Info Icon<\/a>.<br><br>Any extras can be drag and dropped as child to this component&#8217;s gameobject. For super UI control, add a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/ui-billboard\/\" title=\"UI Billboard\">UI Billboard<\/a> to <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/stat-bar\/\" title=\"Stat Bar\">Stat Bar<\/a> and <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/info-icon\/\" title=\"Info Icon\">Info Icon<\/a>, or use the prefab for both StatBarInfoIcon in \/prefabs\/UI.<br><br><strong>Event Visual<\/strong><br>Animates the component using public functions. <br><br><strong>Popup Spawner<\/strong><br>Displays a popup of the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-amount\/\" title=\"Item Amount\">Item Amount<\/a> that is added or removed from the inventory.<br><br><strong>Stat Bar<\/strong><br>Assigned to Item Container Overall Container Limit Stat in the left hand corner. Displays the Container storage space of the Item Container.<br><br><strong>Info Icon<\/strong><br>Displays either the Specific Item type of the container or the largest amount of <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> in there. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Scripting<\/h2>\n\n\n\n<p>This section will cover scripting for developers wanting to hook into the system. Most public methods have a summary and info on what each parameter is for. <\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\"><code>\/\/Actions\n\n\/\/Triggers when there any changes to the Item Container, both adding and removing\npublic Action&lt;ItemAmount, bool&gt; OnItemAmountsChangedAction;\n\n\/\/Triggers when an ItemAmount is added\npublic Action&lt;ItemAmount&gt; OnItemAmountAddAction;\n\n\/\/Triggers when an ItemAmount is removed\n\/\/Note that this Action returns a COPY of the ItemAmount\n\/\/The actual ItemAmount has been removed and does not exist anymore\npublic Action&lt;ItemAmount&gt; OnItemAmountRemoveAction;\n\n\/\/Triggers when the OverallLimitStat is reached\npublic Action OnHitOverallLimitAction;\n\n\/\/Triggers when the StackLimitStat is reached\npublic Action OnHitStackLimitAction;\n\n\/\/Examples of how to set up the Actions\nprivate void Start()\n{\n    itemContainer.OnItemAmountsChangedAction += (item, added) =&gt; DoSomething(item, added);\n    itemContainer.OnItemAmountAddAction += (item) =&gt; DoSomething(item);\n    itemContainer.OnItemAmountRemoveAction += (item) =&gt; DoSomething(item);\n    itemContainer.OnHitOverallLimitAction += DoSomething();\n    itemContainer.OnHitStackLimitAction += DoSomething();\n}\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Use the ItemAmounts pre-added into the container to restart the container from there - will not do anything if the game is being loaded\n\/\/\/ &lt;\/summary&gt;\npublic void InitialiseState()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Opens this individual ItemContainer in the InventoryManager UI, or if it currently open, close it\n\/\/\/ Will only work with interactWithMenusOpen bool set to true on InputManager\n\/\/\/ &lt;\/summary&gt;\npublic void OnClick()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Add an ItemAmount to this ItemContainer within the storage constraints\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmountToAdd&quot;&gt;The ItemAmount, containing the item and the quantity&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;overrideAmount&quot;&gt;Optional value for the amount of itemAmountToAdd amount. This will override the amount if greater than 0&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;updateOverallContainerLimitStat&quot;&gt;Updates the overallContainerLimitStat by default, pass false to skip the update&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;Remainder of not stored&lt;\/returns&gt;\npublic double AddItem(ItemAmount itemAmountToAdd, double overrideAmount = 0, bool updateOverallContainerLimitStat = true)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Removes an ItemAmount from the container if it exists, over all stacks\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to remove, uses the item._id to match so does not have to be the ItemAmount instance&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;amount&quot;&gt;Optional override amount to remove, otherwise uses itemAmount.Amount&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;Whether any or all was removed&lt;\/returns&gt;\npublic bool RemoveItem(ItemAmount itemAmount, double amount = 0)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Transfers all items from this container into another.\n\/\/\/ Will respect stack limits, container capacity, etc.\n\/\/\/ Leaves any untransferred items in the source container.\n\/\/\/ &lt;\/summary&gt;\npublic void TransferAllItemAmounts(ItemContainer targetContainer)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Clears the ItemContainer\n\/\/\/ &lt;\/summary&gt;\npublic void RemoveAllItems()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Makes several different checks to test if the container is full, or can accept a specified ItemAmount in full\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;incoming&quot;&gt;Can this Item Container fit this ItemAmount in full&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;Whether the Item Container is full&lt;\/returns&gt;\npublic bool IsFull(ItemAmount incoming = null)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get the sum of all ItemAmounts in this ItemContainer\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;returns&gt;The total number of ItemAmount.Amount&lt;\/returns&gt;\npublic double GetTotalItems()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get the ItemAmount from the given Item\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;item&quot;&gt;The Item to check for, uses the Item._id&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;ItemAmount, or null if not found&lt;\/returns&gt;\npublic ItemAmount GetItemAmount(Item item)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get the ItemAmount from the given id\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;id&quot;&gt;The id of the Item to look for&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;ItemAmount, or null if not found&lt;\/returns&gt;\npublic ItemAmount GetItemAmount(int id)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get the total amount of all of a certain ItemAmount.Item\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount for which the Item._id is checked&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;The sum total of all of this type of Item&lt;\/returns&gt;\npublic double GetItemCount(ItemAmount itemAmount)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Checks to see if the any of the incoming List&lt;Item&gt; have an id that matches any of the specificItemType id&#39;s. StorageType.All returns true.\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;items&quot;&gt;The Items List to check against&lt;\/param&gt;\n\/\/\/ &lt;returns&gt;Whether any of the Item._id matches any of the specificItemTypes&lt;\/returns&gt;\npublic bool DoItemTypesMatch(List&lt;Item&gt; items)\n\n\/\/Saving and Loading \npublic object CaptureState()\npublic void RestoreState(object state)<\/code><\/pre><\/div>\n\n\n\n<p><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Item Containers are the flexible storage solution linking up to the Inventory Manager as a Global Storage solution if required. They can be used singularly, or used in this combined method. Setting up There is a prefab for the Item Container located in \/Prefabs\/ItemContainer_Master. If you wanted to set up from scratch, a couple [&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-2196","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":1594,"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\/2196","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=2196"}],"version-history":[{"count":19,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2196\/revisions"}],"predecessor-version":[{"id":2523,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2196\/revisions\/2523"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2196"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2196"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}