{"id":13786211,"url":"https://github.com/yankooliveira/signals","last_synced_at":"2025-05-11T22:30:49.691Z","repository":{"id":50038393,"uuid":"117620459","full_name":"yankooliveira/signals","owner":"yankooliveira","description":"A typesafe, lightweight messaging lib for Unity.","archived":false,"fork":false,"pushed_at":"2021-06-05T18:52:15.000Z","size":10,"stargazers_count":216,"open_issues_count":2,"forks_count":34,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-17T22:36:12.774Z","etag":null,"topics":[],"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/yankooliveira.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}},"created_at":"2018-01-16T02:29:21.000Z","updated_at":"2024-10-30T07:57:22.000Z","dependencies_parsed_at":"2022-08-03T17:01:06.439Z","dependency_job_id":null,"html_url":"https://github.com/yankooliveira/signals","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/yankooliveira%2Fsignals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yankooliveira%2Fsignals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yankooliveira%2Fsignals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yankooliveira%2Fsignals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yankooliveira","download_url":"https://codeload.github.com/yankooliveira/signals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253645101,"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":[],"created_at":"2024-08-03T19:01:11.746Z","updated_at":"2025-05-11T22:30:49.422Z","avatar_url":"https://github.com/yankooliveira.png","language":"C#","funding_links":[],"categories":["GamePlay","Message Bus","Game Development"],"sub_categories":["HUD","Unity Engine: Resources"],"readme":"# Signals\n### A typesafe, lightweight messaging lib for Unity.\n---\nInspired by StrangeIOC, minus the clutter.\nOriginally based on [CSharpMessenger](http://wiki.unity3d.com/index.php/CSharpMessenger_Extended).\nConverted to use strongly typed parameters and prevent use of strings as ids.\n\nSpecial thanks to Max Knoblich for code review and Aswhin Sudhir for the anonymous function asserts suggestion.\n\nSupports up to 3 parameters (more than that, and you should probably use a specialized VO as a single parameter).\nYou can read about the reasons behind it [on my blog](http://yankooliveira.com/index.php/2018/01/15/signals).\n\n### Usage:\n1) Define your signal with up to 3 payload parameters, eg:\n```c#\npublic class EndGameSignal : ASignal {}\npublic class ScoreSignal : ASignal\u003cstring, int\u003e {}\n```\n2) Add listeners on portions that should react, eg on Awake():\n```c#\nSignals.Get\u003cScoreSignal\u003e().AddListener(OnScore);\n```\n3) Dispatch, eg:\n```c#\nSignals.Get\u003cScoreSignal\u003e().Dispatch(playerName, playerScore);\n```\n4) Don't forget to remove the listeners upon destruction! Eg on OnDestroy():\n```c#\nSignals.Get\u003cScoreSignal\u003e().RemoveListener(OnScore);\n```\n5) You also have your local Signal Hub that is specific to a given object instead of using the global one. The syntax is exactly the same.\n```c#\nSignalHub playerSignals = new SignalHub();\nplayerSignals.Get\u003cScoreSignal\u003e().Dispatch(playerName, playerScore);\n```\n\n\nHit me up on [twitter](https://twitter.com/yankooliveira) for any suggestions or questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyankooliveira%2Fsignals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyankooliveira%2Fsignals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyankooliveira%2Fsignals/lists"}