{"id":2431,"date":"2025-11-18T21:11:05","date_gmt":"2025-11-18T21:11:05","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2431"},"modified":"2025-12-28T19:07:09","modified_gmt":"2025-12-28T19:07:09","password":"","slug":"popup-spawner","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/popup-spawner\/","title":{"rendered":"Popup Spawner"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>Add as a child to either a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/resource-node\/\" title=\"Resource Node\">Resource Node<\/a>, <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">Item Container<\/a>, <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/crafter\/\" title=\"Crafter\">Crafter<\/a> or <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/world-item\/\" title=\"World Item\">WorldItem<\/a> to spawn popups. It hooks in to the Actions provided to spawn.<\/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 Popup Spawner located in \/prefabs\/UI.<br><br>Setting up without the prefab is easy and only requires a Popup prefab which contains the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> component and setting Distance and Fade Rise Duration.<br><br><a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popups<\/a> spawn from the position of this component&#8217;s transform and have a handy gizmo to show where they will end up. <br><br><a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popups<\/a> also parent directly under a transform created at runtime by the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/resource-and-production-manager\/\" title=\"Resource And Production Manager\">Resource And Production Manager<\/a> for tidyness and for when the originating object gets destroyed, the popup does not go with it and has its own lifetime.<\/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>Popup Prefab<\/strong><br>Assign a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> gameobject\/prefab to instantiate. This gameobject should contain the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> component for this to work. <br><br><strong>Rise Distance<\/strong><br>How far the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> will rise up once instantiated. <br><br><strong>Rise Fade Duration<\/strong><br>How long will it take for the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> to rise and fade once instantiated.<br><br><strong>Rise Curve<\/strong><br>Assign a custom easing to the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup\/\" title=\"Popup\">Popup<\/a> over its Rise Fade Duration.<\/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>\/\/\/ &lt;summary&gt;\n\/\/\/ Manually add a popup to be spawned\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;itemAmount&quot;&gt;The ItemAmount to use for the Item&#39;s Icon and the Amount&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;added&quot;&gt;Use &quot;+&quot; if added or &quot;-&quot; before the Amount&lt;\/param&gt;\npublic void SpawnPopupDirect(ItemAmount itemAmount, bool added = true)\n\n\/\/The Start function in this component - \nprivate void Start()\n{\n    if (resourceNode != null)\n    {\n        resourceNode.OnResourceTriggerAction += (itemAmount) =&gt; StartCoroutine(SpawnPopup(itemAmount, true));\n    }\n\n    if (itemContainer != null)\n    {\n        itemContainer.OnItemAmountAddAction += (itemAmount) =&gt; StartCoroutine(SpawnPopup(itemAmount, true));\n        itemContainer.OnItemAmountRemoveAction += (itemAmount) =&gt; StartCoroutine(SpawnPopup(itemAmount, false));\n    }\n\n    if (crafter != null)\n    {\n        crafter.OnCraftAndStoreAction += (itemAmount, ItemContainer) =&gt; StartCoroutine(SpawnPopup(itemAmount, true));\n    }\n\n    if (worldItem != null)\n    {\n        worldItem.OnItemCollect += (itemAmount) =&gt; StartCoroutine(SpawnPopup(itemAmount, true));\n    }\n}\n\n\/\/You could hook up very similar actions for your own ItemAmounts to spawn <\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Add as a child to either a Resource Node, Item Container, Crafter or WorldItem to spawn popups. It hooks in to the Actions provided to spawn. Setting up There is a prefab Popup Spawner located in \/prefabs\/UI. Setting up without the prefab is easy and only requires a Popup prefab which contains the Popup [&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-2431","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":324,"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\/2431","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=2431"}],"version-history":[{"count":7,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2431\/revisions"}],"predecessor-version":[{"id":2600,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2431\/revisions\/2600"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2431"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2431"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}