{"id":20427487,"url":"https://github.com/tinrab/databind","last_synced_at":"2025-04-12T19:10:44.746Z","repository":{"id":94379916,"uuid":"54448428","full_name":"tinrab/DataBind","owner":"tinrab","description":"Simple data binding for Unity","archived":false,"fork":false,"pushed_at":"2016-11-23T05:23:23.000Z","size":7771,"stargazers_count":71,"open_issues_count":0,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T13:21:20.982Z","etag":null,"topics":["databind","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/tinrab.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-22T05:41:05.000Z","updated_at":"2025-02-06T07:47:56.000Z","dependencies_parsed_at":"2023-03-05T08:15:21.900Z","dependency_job_id":null,"html_url":"https://github.com/tinrab/DataBind","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/tinrab%2FDataBind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinrab%2FDataBind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinrab%2FDataBind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinrab%2FDataBind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinrab","download_url":"https://codeload.github.com/tinrab/DataBind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618277,"owners_count":21134200,"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":["databind","unity"],"created_at":"2024-11-15T07:20:41.010Z","updated_at":"2025-04-12T19:10:44.703Z","avatar_url":"https://github.com/tinrab.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataBind\nSimple data binding for unity.\n\n## Usage\n1. Import package file DataBind.unitypackage into Unity\n2. Add `DataBindContext` to parent object\n3. Add `Bind*` components to children\n4. Use `dataBindContext[key] = value` to bind values\n\nCheck out Demo/DemoScene for details.\n\n## Bind Text\nSurround keys with double curly braces in UI Text and set values in parent `DataBindContext`\n\n![alt text](docs/Component.png)\n\n```csharp\nvar context = GetComponent\u003cDataBindContext\u003e();\ncontext[\"Username\"] = \"Bobby\";\n```\nResult:\n\n![alt text](docs/View.png)\n\n## Custom Binds \nPackage contains components for binding UI Text, UI Image's sprite and UI Graphics's color. Custom binds can be created simply by implementing `IBindable` interface.\n\n```csharp\nusing UnityEngine;\nusing UnityEngine.UI;\n\npublic class BindPosition : MonoBehaviour, IBindable\n{\n\t[SerializeField]\n\tprivate Transform m_Target;\n\t[SerializeField]\n\tprivate string m_Key;\n\n\tpublic void Bind(DataBindContext context)\n\t{\n\t\tif (context.ContainsKey(m_Key)) {\n\t\t\tm_Target.position = (Vector3)context[m_Key];\n\t\t}\n\t}\n}\n```\n\n## Bind any property\nYou can bind any two properties using `BindProperty` component. Currently, there is no type checking. If destination property is of type `String`, then source will be converted using `ToString` method.\n\n![alt text](docs/BindProperty.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinrab%2Fdatabind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinrab%2Fdatabind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinrab%2Fdatabind/lists"}