{"id":2362,"date":"2025-11-16T21:31:32","date_gmt":"2025-11-16T21:31:32","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2362"},"modified":"2025-11-21T20:43:18","modified_gmt":"2025-11-21T20:43:18","password":"","slug":"input-manager","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/input-manager\/","title":{"rendered":"Input Manager"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>This Manager class manages all world Input for the Resource And Production asset. <br><br>It can use the New Input System (for which you will find a ready made ActionMap in the root of the asset), or the Old Input System. It gathers input using raycasts in both 3d and 2d so you can use in both game types. It is also not consistant input, so only on clicking will trigger the raycasts for performance gain. The input also works using a touchscreen device.<br><br>There are various Control Mode presets which are explained below. <br><br>It handles the IPlayerInteractable interface, which hooks into the OnClick, OnHold and OnHoldRelease methods for the various components that implement it. <br><br>It also handles opening of the Inventory with a button and triggers various events that many other components hook into. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"756\" height=\"741\" src=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-31.png\" alt=\"\" class=\"wp-image-2367\" style=\"width:400px\" srcset=\"https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-31.png 756w, https:\/\/golemitegames.com\/wp-content\/uploads\/2025\/11\/image-31-300x294.png 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/figure>\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 Input Manager located in \/prefabs\/Managers or the main prefab for the ResourceAndProductionManager also contains this manager.<br><br>Setting up otherwise is as simple as adding the component to a gameobject.<\/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>Input Type<\/strong><br>New Input System &#8211; You are using the New Input System. Uses the callbacks set up in the ActionMap located in the root of the asset. <br><br>Old Legacy Input System &#8211; You are using the Old Input System. Uses Update logic to trigger input.<br><br><strong>Control Mode<\/strong><br>Control Modes are used to very basically judge what kind of game and input you need. Even if does not match completly, one of the 3 control modes should fit most styles just for input purposes. <br><br>Overseer &#8211; Camera pointing down at the world without a physical player. Raycasts straight from the Camera with an Infinite distance. <br><br>First Person &#8211; Camera in First Person, all Raycasting is done from the Camera using the Interact Range for distance. <br><br>Player Controlled &#8211; Camera pointing down at the world with a physical player. Raycasts straight from the Camera, but Interaction is based on how close the player is (Interact Range) and the Direct Clicks Only setting. <br><br><strong>Interact With Menus Open<\/strong><br>If enabled, Interacting will work while menus are open, otherwise Interaction is limited to when there are no menus open. <br><br><strong>Interact Range<\/strong><br>Only available in First Person and Player Controlled Mode.<br><br>In First Person Control Mode, this is the max raycast distance from the Camera. <br><br>In Player Controlled, this is the range from the player transform to the IPlayerInteractable objects.<br><br><strong>Direct Clicks Only<\/strong><br>Only available in Player Controlled Control Mode.<br><br>If enabled, when in the player transform is in range, the clicks must still be directly on the Interactable objects, otherwise, when in range, you can click anywhere to interact. <br><br><strong>Player Transform<\/strong><br>Only available in the Player Controlled Control Mode. <br><br>Assign the players transform to judge the distance to the interactable objects.<br><br><strong>Current Target <\/strong><br>For information purposes about which IPlayerInteractable object is current available to interact with based on the raycasts. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Events<\/h2>\n\n\n\n<p><strong>On Click Event<\/strong><br>Triggers when the InputManager detects a valid click.<br><br><strong>On Hold Event<\/strong><br>Triggers when the InputManager detects a Hold, and triggers every frame.<br><br><strong>On Hold Release Event<\/strong><br>Triggers when the InputManager detects a release.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Scripting<\/h2>\n\n\n\n<p>There are a few Actions to hook into as below<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\" data-show-lang=\"0\"><code>\/\/Actions\n\n\/\/Triggers when there is movement through either the Horizontal axis or the moveAction\npublic Action&lt;Vector2&gt; OnMove;\n\n\/\/Triggers when there is movement through either the Vertical axis or the lookAction\npublic Action&lt;Vector2&gt; OnLook;\n\n\/\/Triggers when the InputManager detects a valid click\npublic UnityEvent OnClickEvent;\n\n\/\/Triggers when the InputManager detects a Hold, and triggers every frame\npublic UnityEvent OnHoldEvent;\n\n\/\/Triggers when the InputManager detects a release\npublic UnityEvent OnHoldReleaseEvent;\n\n\/\/Examples\npublic void Start() \n{\n    \/\/Note all callback methods must have the same signature as the Action\n    InputManager.Instance.OnMove += HandleMove;\n    InputManager.Instance.OnLook += HandleLook;\n    InputManager.Instance.OnClickEvent += Click;\n    InputManager.Instance.OnHoldEvent += Hold;\n    InputManager.Instance.OnHoldReleaseEvent += Release;\n}<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This Manager class manages all world Input for the Resource And Production asset. It can use the New Input System (for which you will find a ready made ActionMap in the root of the asset), or the Old Input System. It gathers input using raycasts in both 3d and 2d so you can use [&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-2362","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":626,"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\/2362","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=2362"}],"version-history":[{"count":6,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2362\/revisions"}],"predecessor-version":[{"id":2370,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2362\/revisions\/2370"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2362"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2362"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}