{"id":2153,"date":"2025-11-11T20:54:30","date_gmt":"2025-11-11T20:54:30","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2153"},"modified":"2025-12-28T22:17:36","modified_gmt":"2025-12-28T22:17:36","password":"","slug":"resource-node","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/resource-node\/","title":{"rendered":"Resource Node"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>Resource Nodes act as the interaction layer for mining and gathering resources, with various options for how and when resources are collected. <\/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 are some sample prefabs in Demo\/Resources or you can create your own starting from \/Prefabs\/ResourceNode_Master.<br><br>If you wanted to set up from scratch, a couple of things to remember &#8211; <br>The parent should contain the Resource Node component, with the Mesh with Collider (3d or 2d) attached as a child. Any other components you wish to add to the Resource Node such as a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/stat-bar\/\" title=\"\">StatBar<\/a> for the Hp, an <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/info-icon\/\" title=\"\">Info Icon<\/a> to display the first Resource type, or a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup-spawner\/\" title=\"\">Popup Spawner<\/a> should also be children of the Resource Node gameobject.<br>It should look something like this if you wanted every add on.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"322\" height=\"99\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-9.png\" alt=\"\" class=\"wp-image-2259\" style=\"width:240px;height:auto\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-9.png 322w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-9-300x92.png 300w\" sizes=\"(max-width: 322px) 100vw, 322px\" \/><\/figure>\n\n\n\n<p><br>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<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=\"687\" height=\"926\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-34.png\" alt=\"\" class=\"wp-image-2603\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-34.png 687w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-34-223x300.png 223w\" sizes=\"(max-width: 687px) 100vw, 687px\" \/><\/figure>\n\n\n\n<p><strong>Hp<\/strong> <strong>Stat<\/strong><br>Controls how much damage the Resource Node can take. See the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/stat\/\" title=\"\">Stat<\/a> class for more info on this class.<\/p>\n\n\n\n<p><strong>Interact Behaviour<\/strong><br>Click &#8211; A simple click will interact with the Resource Node, applying the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/miner\/\" title=\"Miner\">Miner<\/a> damage in a single hit.<br><br>Click and Hold &#8211; Click and Hold to apply damage over time on the Resource Node. It will apply the same amount of damage every second as a single click would.<\/p>\n\n\n\n<p>Disabled &#8211; No interaction will occur with this Resource Node.<br><br><strong>Resource Trigger Type<\/strong><br>How and when resources should be triggered and given to the player. <br>See <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/resource\/\" title=\"Resource\">Resource<\/a> for more details on this class.<br><br>Hp Threshold &#8211; Give resources based on the remaining Hp remaining. You can manually set an Amount, or a range (click the dot) and set the chance this occur. This method should be chosen when more specific requirements for giving resources need to be met.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"690\" height=\"133\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-2.png\" alt=\"\" class=\"wp-image-2158\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-2.png 690w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-2-300x58.png 300w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"45\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-6.png\" alt=\"\" class=\"wp-image-2164\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-6.png 712w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-6-300x19.png 300w\" sizes=\"(max-width: 712px) 100vw, 712px\" \/><\/figure>\n\n\n\n<p><strong>Auto Distribute Thresholds<\/strong><br>Only available on Hp Threshold Trigger Type &#8211; Will equally distribute the HpThreshold evenly. So if you have 10 resources, it will evenly distrbute to give resources at 100%, 90%, 80% and so one.<\/p>\n\n\n\n<p>Damage Dealt &#8211; Simply gives the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> assigned with the Chance, with the Amount matching the damage dealt by the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/miner\/\" title=\"Miner\">Miner<\/a> class.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"92\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-3.png\" alt=\"\" class=\"wp-image-2159\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-3.png 693w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-3-300x40.png 300w\" sizes=\"(max-width: 693px) 100vw, 693px\" \/><\/figure>\n\n\n\n<p><strong>Collect Type <\/strong><br>Auto Inventory &#8211; Adds the resource straight to the inventory system.<br>World Collect &#8211; Spawns a <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/world-item\/\" title=\"World Item\">WorldItem<\/a> gameobject that can then be collected later by the player. This is setup on the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item\/\" title=\"Item\">Item<\/a> Scriptable Object<br><br><strong>Use Global Container<\/strong><br>If true stores any Resources gained through the global Inventory storage system. <br>If false, an <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/item-container\/\" title=\"Item Container\">Item Container<\/a> is required to be assigned to store any Resources gained. <br><br><strong>Auto Mine<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"78\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-4.png\" alt=\"\" class=\"wp-image-2160\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-4.png 711w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-4-300x33.png 300w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/figure>\n\n\n\n<p>Automatically mines the Resource Node without interaction. This can also be set to start and stop via code. <br><br><strong>Mine Interval<\/strong><br>How often the automatic mining should occur.<\/p>\n\n\n\n<p><strong>Mine Damage<\/strong><br>How much damage should be applied, this is seperate from the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/miner\/\" title=\"Miner\">Miner <\/a>class. <br><br><strong>Resources<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"573\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-5.png\" alt=\"\" class=\"wp-image-2163\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-5.png 717w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-5-300x240.png 300w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/figure>\n\n\n\n<p>Resources are assigned into the list with varying parameters. See <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/resource\/\" title=\"Resource\">Resource <\/a>class for more info on exactly what each of the fields means. <br><br>The example above will generate the following &#8211; <br>First hit at 100% hp will generate between 1(float) and 2(float) Amount of Stone with a 100% chance.<br>Once hp is below 60% it will generate between 2(float) and 3(float) Amount of Stone with a 100% chance.<br>Once hp is below 40% it will generate between 3(float) and 4(float) Amount of Stone with a 100% chance.<br>Once hp is below 20% it will generate between 4(float) and 5(float) Amount of Stone with a 100% chance.<br>Once hp is depleted it will generate between 5(float) and 6(float) Amount of Stone with a 100% chance.<br>All of these are not set to recur.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Events<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"714\" height=\"492\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-7.png\" alt=\"\" class=\"wp-image-2165\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-7.png 714w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-7-300x207.png 300w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><\/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 Damage Event<\/strong><br>Only available on Click interact behaviour. Triggers whenever the Resource Node is clicked. <br><br><strong>On Hold Damage Event<\/strong><br>Only available on Hold And Click interact behaviour. Triggers every Event Frequency. Event Frequency &#8211; How often the On Hold Damage Event should fire as damage is continuous, its usually undesirable for the event to fire every frame.<br><br><strong>On Resource Trigger Event<\/strong><br>Triggers when Resources are actually collected. <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/popup-spawner\/\" title=\"Popup Spawner\">Popup Spawner<\/a> uses the Action&lt;ItemAmount&gt; version of this UnityEvent to trigger its popups. <br><br><strong>On Resource Depleted Event<\/strong><br>Triggers when the Resource Node runs out of Hp.<br><br>Events have counterpart Action versions that sometimes contain additional information than the UnityEvent versions. See scripting below to learn how to hook into these.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px\">Saving and Loading<\/h2>\n\n\n\n<p>All Resource Nodes 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>Three parts are saved for Resource Nodes, the Current Hp, Auto Mine bool (As this can be set via code) and the Collected bool of each of the Resources. (This one is hidden in Property Drawer but can be seen in Debug mode). Any Resource Nodes 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 below scripting for more details on how to do this) and then finally reinstate the Resource Node as saved.  <\/p>\n\n\n\n<p>Loading is fairly straght forward and will load exactly as saved. Destroyed Resource Nodes 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 Resource Nodes 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 Resource Node, 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 Resource that is gained from mining.<br><br><strong>Stat Bar<\/strong><br>Assigned to Resource Node Hp Stat in the left hand corner to display the Hp of the ResourceNode.<br><br><strong>Info Icon<\/strong><br>Displays the first Resource Item Icon in the Resources list<\/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\/\/Triggers on click damage\npublic Action&lt;float&gt; OnDamageAction;\n\n\/\/Triggers on click and hold damage\npublic Action&lt;float&gt; OnHoldDamageAction;\n\n\/\/Triggers on Resource collected\npublic Action&lt;ItemAmount&gt; OnResourceTriggerAction;\n\n\/\/Triggers when the Resource Node has no more Hp\npublic Action OnResourceDepletedAction;\n\n\/\/Examples of how to set up the Actions\nprivate void Start()\n{\n    resourceNode.OnDamageAction += (damage) =&gt; DoSomething(damage);\n    resourceNode.OnHoldDamageAction += (damage) =&gt; DoSomething(damage);\n    resourceNode.OnResourceTriggerAction += (itemAmount) =&gt; DoSomething(itemAmount);\n    resourceNode.OnResourceDepletedAction += DoSomething;\n}\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Applies damage, and checks conditions for resources to be given\n\/\/\/ &lt;\/summary&gt;\npublic void OnClick()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Applies damage per frame, and checks conditions for resources to be given every second\n\/\/\/ &lt;\/summary&gt;\npublic void OnHold()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ The main function to damage the ResourceNode\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;damage&quot;&gt;The damage to apply&lt;\/param&gt;\npublic void Damage(float damage)\n\/\/This method will simply modify the Hp of the Resource Node and nothing more\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Get a given resource depending on its chance and parameters set for the Resource\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;resource&quot;&gt;The Resource to give&lt;\/param&gt;\npublic void GetResource(Resource resource)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Checks to see if the node has no Hp and not set to Infinite\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;returns&gt;true if current Hp less than or equal to 0 and not set to Infinite&lt;\/returns&gt;\npublic bool IsDepleted()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Returns if the node still has Hp or is set to Infinite\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;returns&gt;&lt;\/returns&gt;\npublic bool HasHp()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Starts auto mining \n\/\/\/ &lt;\/summary&gt;\npublic void StartAutoMine()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Stops auto mining\n\/\/\/ &lt;\/summary&gt;\npublic void StopAutoMine()\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 Resource Nodes act as the interaction layer for mining and gathering resources, with various options for how and when resources are collected. Setting up There are some sample prefabs in Demo\/Resources or you can create your own starting from \/Prefabs\/ResourceNode_Master. If you wanted to set up from scratch, a couple of things to remember [&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-2153","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":1389,"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\/2153","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=2153"}],"version-history":[{"count":32,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2153\/revisions"}],"predecessor-version":[{"id":2605,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2153\/revisions\/2605"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2153"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2153"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}