{"id":19715393,"url":"https://github.com/erodozer/bepinex.unityinput","last_synced_at":"2026-04-29T15:01:33.316Z","repository":{"id":47044838,"uuid":"388917981","full_name":"erodozer/BepInEx.UnityInput","owner":"erodozer","description":"Basic Harmony Hooks to allow plugins to override Unity's Global Input responses","archived":false,"fork":false,"pushed_at":"2021-09-19T14:40:26.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-27T21:51:12.357Z","etag":null,"topics":["bepinex","bepinex-plugins","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erodozer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-23T20:24:04.000Z","updated_at":"2023-10-28T06:52:05.000Z","dependencies_parsed_at":"2022-09-24T21:30:15.880Z","dependency_job_id":null,"html_url":"https://github.com/erodozer/BepInEx.UnityInput","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/erodozer/BepInEx.UnityInput","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erodozer%2FBepInEx.UnityInput","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erodozer%2FBepInEx.UnityInput/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erodozer%2FBepInEx.UnityInput/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erodozer%2FBepInEx.UnityInput/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erodozer","download_url":"https://codeload.github.com/erodozer/BepInEx.UnityInput/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erodozer%2FBepInEx.UnityInput/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260653881,"owners_count":23042645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bepinex","bepinex-plugins","unity"],"created_at":"2024-11-11T22:38:16.193Z","updated_at":"2026-04-29T15:01:33.257Z","avatar_url":"https://github.com/erodozer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BepInEx.UnityInput\r\n\r\nAdds Harmony hooks so that BepInEx plugins may intercept Unity's Global Input system.\r\n\r\nDevelopment for this largely stems from interest of extending functionality of Illusion games, such as Koikatsu, which extensively make use of `UnityEngine.Input` in places where by best practice it shouldn't.  \r\nIn areas where you wish to use original game functionality through the simulation of button presses on the UI, you may need to occasionally fake an Input state.\r\n\r\n## Requirements\r\n\r\n* Install BepInEx 5.4 or later.\r\n\r\n## Using this in your own Plugins\r\n\r\nPlugins that require BepInEx.UnityInput should specify the dependency like so\r\n```\r\n    [BepInPlugin(GUID, \"MyPlugin\", Version)]\r\n    [BepInDependency(\"github.lunared.bepinex.unityinput\", BepInDependency.DependencyFlags.HardDependency)]\r\n    internal class MyPlugin : BaseUnityPlugin\r\n    {\r\n    }\r\n```\r\n\r\nOnce your plugin is set up to depend on the UnityInput one, you can now reference the Global methods where you need to.\r\n\r\nThe functions are all exposed similar to Unity's own Input system.\r\nIn this example, we can demonstrate how to click an Action button in Koikatsu's HSprite UI\r\n\r\n```csharp\r\nusing UnityEngine;\r\nusing KKAPI.MainGame;\r\nusing BepInEx.Unity; // this has InputSimulator in it, which we use to override input\r\n\r\nnamespace MyPlugin \r\n{\r\n    internal class MyPluginController : GameCustomFunctionController \r\n    {\r\n\r\n        protected override void OnStartH(HSceneProc proc, bool freeH)\r\n        {\r\n            StartCoroutine(PickAction(proc));\r\n        }\r\n\r\n        IEnumerator PickAction(HSceneProc proc)\r\n        {\r\n            while (true)\r\n            {\r\n                // get the list of visible actions from one of the interfaces\r\n                var choices = proc.sprite.sonyu.categoryActionButton.lstButton.Where(\r\n                    button =\u003e button.isActiveAndEnabled \u0026\u0026 button.interactable\r\n                ).ToList();\r\n\r\n                // leverage simulating clicking in the menu\r\n                var index = Random.RandomRangeInt(0, choices.Count);\r\n                var nextAction = choices[index];\r\n\r\n                // many koikatsu actions check for left click mouse up \r\n                // within their onClick handler\r\n                InputSimulator.MouseButtonUp(0);\r\n                // perform our action\r\n                nextAction?.onClick?.Invoke();\r\n                // reset the input state after performing the action\r\n                InputSimulator.UnsetMouseButton(0);\r\n                yield return new WaitForSeconds(1f);\r\n            }\r\n        }\r\n    }\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferodozer%2Fbepinex.unityinput","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferodozer%2Fbepinex.unityinput","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferodozer%2Fbepinex.unityinput/lists"}