{"id":19022549,"url":"https://github.com/manjitbedi/controller","last_synced_at":"2026-05-18T02:04:47.726Z","repository":{"id":154435114,"uuid":"631739185","full_name":"ManjitBedi/Controller","owner":"ManjitBedi","description":"Playground for using controllers with Unity","archived":false,"fork":false,"pushed_at":"2024-05-22T16:49:42.000Z","size":4742,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T10:46:24.243Z","etag":null,"topics":["unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ManjitBedi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T00:18:09.000Z","updated_at":"2025-03-19T11:21:54.000Z","dependencies_parsed_at":"2024-11-08T20:39:39.856Z","dependency_job_id":null,"html_url":"https://github.com/ManjitBedi/Controller","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ManjitBedi/Controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManjitBedi%2FController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManjitBedi%2FController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManjitBedi%2FController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManjitBedi%2FController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ManjitBedi","download_url":"https://codeload.github.com/ManjitBedi/Controller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ManjitBedi%2FController/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33162448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["unity"],"created_at":"2024-11-08T20:26:39.207Z","updated_at":"2026-05-18T02:04:47.708Z","avatar_url":"https://github.com/ManjitBedi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Controller - playground for using controllers with Unity\n\nNote: there are bugs in the code - to be fixed!\n\nI am using the project to try out working with controllers with Unity; so far all of the projects that I have worked on used touches on mobile devices or mouse input \u0026 keyboard input on desktops.  \n\nNow it is time to try out using controllers.\n\nInitially, I am developing on MacOs with a Xbox controller connected over BlueTooth - woot.\n\n\nThe simple game is using an Action map already provided with some sample code from Unity.\n\nThe code will take the direction values from a gamepad or the WASD keys and trigger an event callback.\n\n```\npublic void OnMove(InputAction.CallbackContext context)\n{\n\t// read the value for the \"move\" action each event call\n\tmoveAmount = context.ReadValue\u003cVector2\u003e();\n\tmovementText.text = $\"({moveAmount.x.ToString(\"F2\")}, {moveAmount.y.ToString(\"F2\")})\";\n}\n```\n\nThe movement callback is associated with a PlayerInput instance in the game scene under \"Events\" -\u003e \"gamePlay\".\n\n## Collision detection\n\n- the simple mechanic of the game level is to register a hit of a falling object with the player game object.\n- this requires the falling objects to have the 'is trigger' property set to true; we don't need to use physics with the objects bouncing off of each other\n- also for collisions to register the player and dropping game objects need colliders \u0026 rigid body components\n- the score is updated if the tag of the object collided with is \"Spawned\"\n\n```\n/// \u003csummary\u003e\n/// Upon collision with another game object, increase the score.\n/// \u003c/summary\u003e\n/// \u003cparam name=\"other\"\u003e\u003c/param\u003e\nprivate void OnTriggerEnter(Collider other)\n{\n\t// Check for a match with the specific tag on any GameObject that collides with your GameObject\n\tif (other.gameObject.tag == \"Spawned\")\n\t{\n\t\tscore += 10;\n\t\tscoreText.text = $\"Score: {score.ToString(\"D5\")}\";\n\t\tStartConsumeItemSequence(other.gameObject);\n\t}\n}\n```\n\n## Assets in use\n\nThis project is using:\n\n- for animation [DOTween](http://dotween.demigiant.com)\n- Assets from Everything Library © David OReilly [Everything](https://www.davidoreilly.com/library)\n- a some backgrounds generated by [Dream Studio](https://beta.dreamstudio.ai/generate)\n- font [\"Press Start 2P\"](https://fonts.google.com/specimen/Press+Start+2P)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanjitbedi%2Fcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanjitbedi%2Fcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanjitbedi%2Fcontroller/lists"}