{"id":13663459,"url":"https://github.com/merpheus-dev/GetComponentAttribute","last_synced_at":"2025-04-25T17:30:50.276Z","repository":{"id":112301034,"uuid":"173253352","full_name":"merpheus-dev/GetComponentAttribute","owner":"merpheus-dev","description":"A simple DI plugin for getting MonoBehaviour components just with an attribute over fields.","archived":false,"fork":false,"pushed_at":"2019-08-10T16:01:42.000Z","size":7,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-10T20:37:30.766Z","etag":null,"topics":["attribute","csharp","getcomponent","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/merpheus-dev.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}},"created_at":"2019-03-01T07:12:38.000Z","updated_at":"2024-10-05T09:22:24.000Z","dependencies_parsed_at":"2023-05-12T15:45:21.133Z","dependency_job_id":null,"html_url":"https://github.com/merpheus-dev/GetComponentAttribute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merpheus-dev%2FGetComponentAttribute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merpheus-dev%2FGetComponentAttribute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merpheus-dev%2FGetComponentAttribute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merpheus-dev%2FGetComponentAttribute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merpheus-dev","download_url":"https://codeload.github.com/merpheus-dev/GetComponentAttribute/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250861943,"owners_count":21499190,"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":["attribute","csharp","getcomponent","unity"],"created_at":"2024-08-02T05:02:28.019Z","updated_at":"2025-04-25T17:30:50.040Z","avatar_url":"https://github.com/merpheus-dev.png","language":"C#","readme":"# Get Component Attribute\nA little attribute that makes Awake/Start GetComponent calls redundant.\n\nGenerally in unity, we need to fill fields like this as follows:\n```c#\nprivate Rigidbody rigidbody;\nvoid Start(){\n    rigidbody = GetComponent\u003cRigidbody\u003e();\n}\n```\n\nBut especially while working with teams, if you DI through Scene objects from inspector,\nScene merge conflicts become inevitable. But we shouldn't dirty our code base with those get component methods in various fields.\nIt will reduce readability.\n**This plugin, removes this requirement and takes care of it with an attribute in background before scene begins.**\n\n## Example Usage\n```c#\n[GetComponent] //Get from same gameobject\nprivate Rigidbody rigidbody;\n\n[GetComponent(GetComponentFrom.SceneObject)] //Scan the scene and get from first object.\nprivate Rigidbody rigidbody;\n\n[GetComponent(GetComponentFrom.TargetGameObject,\"MyAwesomeTargetObjectName\")] //Get from a target object at scene\nprivate Rigidbody rigidbody;\n```\n\n## Installation\nJust clone the repo and copy the folder into your project.\n\n## Note\n**[!]GetComponentFrom.TargetGameObject currently runs between awake and start methods.**\n\n## TO-DO\n- Editor time component fetching\n- On-demand(non awake based) runtime component fetching\n- Fetch signals(Event driven fetch on runtime)\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerpheus-dev%2FGetComponentAttribute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerpheus-dev%2FGetComponentAttribute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerpheus-dev%2FGetComponentAttribute/lists"}