{"id":25936827,"url":"https://github.com/chartboost/chartboost-unity-threading","last_synced_at":"2026-05-02T11:42:30.696Z","repository":{"id":252842061,"uuid":"771760081","full_name":"ChartBoost/chartboost-unity-threading","owner":"ChartBoost","description":"Reusable Threading Utilities for Chartboost's Unity Projects","archived":false,"fork":false,"pushed_at":"2024-09-19T18:23:18.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-18T17:01:59.546Z","etag":null,"topics":["android","chartboost","chartboost-mediation","csharp","ios","library","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/ChartBoost.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-03-13T22:38:14.000Z","updated_at":"2024-09-19T18:23:21.000Z","dependencies_parsed_at":"2024-08-13T10:16:30.367Z","dependency_job_id":null,"html_url":"https://github.com/ChartBoost/chartboost-unity-threading","commit_stats":null,"previous_names":["chartboost/chartboost-unity-threading"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-unity-threading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-unity-threading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-unity-threading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-unity-threading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChartBoost","download_url":"https://codeload.github.com/ChartBoost/chartboost-unity-threading/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241773261,"owners_count":20018065,"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":["android","chartboost","chartboost-mediation","csharp","ios","library","unity"],"created_at":"2025-03-04T02:54:49.917Z","updated_at":"2026-05-02T11:42:30.667Z","avatar_url":"https://github.com/ChartBoost.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chartboost Threading Utilities for Unity\nA way of dispatching functions to the main thread in Unity projects. Useful for functions that Unity limits to the main thread from different threads.\n\n# Installation\nThis package is meant to be a dependency for other Chartboost Packages; however, if you wish to use it by itself, it can be installed through UPM \u0026 NuGet as follows:\n\n## Using the public [npm registry](https://www.npmjs.com/search?q=com.chartboost.unity.threading)\n```json\n\"dependencies\": {\n    \"com.chartboost.unity.threading\": \"1.0.1\",\n    ...\n},\n\"scopedRegistries\": [\n{\n    \"name\": \"NpmJS\",\n    \"url\": \"https://registry.npmjs.org\",\n    \"scopes\": [\n    \"com.chartboost\"\n    ]\n}\n]\n```\n\n## Using the public [NuGet package](https://www.nuget.org/packages/Chartboost.CSharp.Threading.Unity)\n\nTo add the Chartboost Core Unity SDK to your project using the NuGet package, you will first need to add the [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) package into your Unity Project.\n\nThis can be done by adding the following to your Unity Project's ***manifest.json***\n\n```json\n  \"dependencies\": {\n    \"com.github-glitchenzo.nugetforunity\": \"https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity\",\n    ...\n  },\n```\n\nOnce \u003ccode\u003eNugetForUnity\u003c/code\u003e is installed, search for `Chartboost.CSharp.Threading.Unity` in the search bar of Nuget Explorer window(Nuget -\u003e Manage Nuget Packages).\nYou should be able to see the `Chartboost.CSharp.Threading.Unity` package. Choose the appropriate version and install.\n# Usage\n\n## Simple Actions\nUtilize the following methods to execute calls on the main thread:\n\n```csharp\nvoid TestAction(object state){\n    //Execute logic on main thread\n    Debug.Log(\"This is called in the main thread\")\n}\n\n// Synchronous; blocks until the callback completes\nMainThreadDispatcher.Send(TestAction);\n\n// Asynchronous; send and forget\nMainThreadDispatcher.Post(TestAction)\n```\n\n## Tasks\nTaks can be utilized in Unity. However, if they contain code that must run on the Unity main thread, the Task too should also be run in the main thread. Use the following:\n\n```csharp\nMainThreadDispatcher.MainThreadTask(async () =\u003e{\n    // Mostly useful when calling task initially from outside of the Unity environment\n    await myTask();\n});\n```\n\n## Task Continuations\nTask continuations are useful when trying to call asynchronous code from a synchronous environment. The following examples represent the same logic.\n\n```csharp\nprivate void MySyncrhonousMethod(){\n    MyAsynchornousTask().ContinueWithOnMainThread(taskContinuationResultTask =\u003e {\n        // perform any continuation logic here.\n        Debug.Log(\"My task finished!\")\n    });\n}\n\nprivate async void MyAsyncrhonousMethod(){\n    var taskResult = awat MyAsynchronousTask();\n    Debug.Log(\"My task finished!\")\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fchartboost-unity-threading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchartboost%2Fchartboost-unity-threading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fchartboost-unity-threading/lists"}