{"id":23543898,"url":"https://github.com/beatthat/binding-behaviours","last_synced_at":"2026-05-18T02:06:31.670Z","repository":{"id":144017006,"uuid":"101021736","full_name":"beatthat/binding-behaviours","owner":"beatthat","description":"Base classes for components that can Bind (as listeners) to various types of events and have all those bindings cleanly/safely unbound, either with an explicit call to Unbind or when the component is destroyed.","archived":false,"fork":false,"pushed_at":"2020-07-23T00:38:28.000Z","size":93,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T22:05:27.206Z","etag":null,"topics":["callbacks","defensive-programming","events","notifications","null-check","observer","observer-pattern","package","package-manager","unity","unity3d"],"latest_commit_sha":null,"homepage":null,"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/beatthat.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":"2017-08-22T04:39:49.000Z","updated_at":"2025-03-02T18:39:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"1d86543d-dc01-49bc-8c6e-5dbdc9d56ceb","html_url":"https://github.com/beatthat/binding-behaviours","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/beatthat/binding-behaviours","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatthat%2Fbinding-behaviours","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatthat%2Fbinding-behaviours/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatthat%2Fbinding-behaviours/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatthat%2Fbinding-behaviours/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beatthat","download_url":"https://codeload.github.com/beatthat/binding-behaviours/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beatthat%2Fbinding-behaviours/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273529292,"owners_count":25121823,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"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":["callbacks","defensive-programming","events","notifications","null-check","observer","observer-pattern","package","package-manager","unity","unity3d"],"created_at":"2024-12-26T07:11:56.086Z","updated_at":"2026-05-18T02:06:26.633Z","avatar_url":"https://github.com/beatthat.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme\"\u003e\u003c/a\u003eWhen you have components that add listeners to other objects--global or otherwise--then it's important (and also tedious) to guarantee that ALL of those listener bindings get cleaned up with the listener component 'unbinds', say is deactivated or destroyed.\n\nThis package contains base classes for both MonoBehaviours and StateMachineBehaviour that provide methods to bind UnityEvents, Actions, Notifications, etc. and have those bindings auto unbind on a common call.\n\n\n## Install\n\nFrom your unity project folder:\n\n    npm init --force # only if you don't yet have a package.json file\n    npm install --save beatthat/binding-behaviours\n\nThe package and all its dependencies will be installed under Assets/Plugins/packages.\n\nIn case it helps, a quick video of the above: https://youtu.be/Uss_yOiLNw8\n\n## Usage\n\n```csharp\npublic class Foo : BindingBehaviour\n{\n    override protected void BindAll()\n    {\n        Bind(\"some-notification-type\", () =\u003e {\n            // this will unbind when Foo::Unbind is called\n        });\n\n        Bind\u003cBar\u003e(\"some-notification-type-2\", (bar) =\u003e {\n            // you can also bind to a notification that wants to send a param\n        });\n\n        Bind\u003cBar2\u003e((UnityEvent\u003cBar2\u003e)this.bar2, (bar2) =\u003e {\n            // also works with Unity events\n        });\n\n        Bind\u003cBar3\u003e((Action\u003cBar3\u003e)this.bar3, (bar3) =\u003e {\n            // also works with csharp events\n        });\n    }\n\n    void OnDestroy()\n    {\n        // all of the above bindings automatically unbind on destroy\n        // or when Foo::Unbind is called explicitly\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatthat%2Fbinding-behaviours","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeatthat%2Fbinding-behaviours","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeatthat%2Fbinding-behaviours/lists"}