{"id":13786203,"url":"https://github.com/pointcache/BasicEventBus","last_synced_at":"2025-05-11T22:30:44.253Z","repository":{"id":50450804,"uuid":"90581494","full_name":"pointcache/BasicEventBus","owner":"pointcache","description":"Basic event bus for unity","archived":false,"fork":false,"pushed_at":"2023-11-14T15:32:41.000Z","size":39,"stargazers_count":87,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-17T22:36:11.449Z","etag":null,"topics":["event","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pointcache.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}},"created_at":"2017-05-08T03:11:02.000Z","updated_at":"2024-11-17T16:25:17.000Z","dependencies_parsed_at":"2024-01-17T05:14:00.975Z","dependency_job_id":"d90e8d9b-51e0-4600-bcc4-3184544afe21","html_url":"https://github.com/pointcache/BasicEventBus","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/pointcache%2FBasicEventBus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FBasicEventBus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FBasicEventBus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pointcache%2FBasicEventBus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pointcache","download_url":"https://codeload.github.com/pointcache/BasicEventBus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253645097,"owners_count":21941311,"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":["event","unity","unity3d"],"created_at":"2024-08-03T19:01:11.627Z","updated_at":"2025-05-11T22:30:43.871Z","avatar_url":"https://github.com/pointcache.png","language":"C#","readme":"# BasicEventBus\nBasic event bus for unity\n\n * Simple\n * Structs for events - no garbage\n * Binding based or direct subscription, no interfaces\n * High performance \n\n # Create an event\n \n Create new struct, assign `IEvent` interface\n \n ```cs\n\npublic struct TestEvent : IEvent\n{\n    public string a;\n    public float b;\n\n}\n```\n\n# Raising an event\n\n```cs\n\nEventBus\u003cTestEvent\u003e.Raise(new TestEvent()\n{\n    b = 7,\n    a = \"Hello\"\n});\n                \n```\n\n# Usage\n\nCheck EventBusExample.cs\n\n1. Declare an event binding object\n\n```cs\n\npublic class EventBusTest : MonoBehaviour\n{\n          EventBinding\u003cTestEvent\u003e _onTestEvent;\n\n\n```\n\n2. Initialize it in Awake/Start/Ctor\n\n```cs\n\n        private void Awake()\n        {\n            _onTestEvent = new EventBinding\u003cTestEvent\u003e(OnEvent);\n            // Add couple more listeners to the same binding   \n            _onTestEvent.Add(onEventButPrintTheStringInstead);\n            _onTestEvent.Add(someUnrelatedMethodWithoutArgs);\n\n            EventBus\u003cTestEvent\u003e.Raise(new TestEvent()\n            {\n                a = \"Hello\"\n            });\n                                              \n            _onTestEvent.Remove(onEventButPrintTheStringInstead);\n            _onTestEvent.Remove(someUnrelatedMethodWithoutArgs);\n\n            // Callback will be called precisely once, then dropped\n            EventBus\u003cTestEvent\u003e.AddCallback(SomeRandomMethod);\n\n            StartCoroutine(CoroutineThatDispatchesEventAfterSomeTime());\n            StartCoroutine(CoroutineThatWaitsForEvent());\n        }\n```\n\n3. Control observing state through `Listen`\n\n```cs\n\n        private void OnEnable()\n        {\n            _onTestEvent.Listen = true;\n        }\n\n        private void OnDisable()\n        {\n            _onTestEvent.Listen = false;\n        }\n```\n\n\n","funding_links":[],"categories":["GamePlay","Message Bus"],"sub_categories":["HUD"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointcache%2FBasicEventBus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpointcache%2FBasicEventBus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpointcache%2FBasicEventBus/lists"}