{"id":21272737,"url":"https://github.com/csinac/wheel","last_synced_at":"2025-06-20T14:35:06.620Z","repository":{"id":263422857,"uuid":"343367267","full_name":"csinac/wheel","owner":"csinac","description":"The Wheel of Pseudo Fortune  - Unity Asset for Customizable Wheel Mechanics","archived":false,"fork":false,"pushed_at":"2021-03-30T20:01:51.000Z","size":1484,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T12:31:49.662Z","etag":null,"topics":["chance","opensource-library","unity-asset","unity-editor","unity-tool","unity3d","unity3d-plugin","unity3d-script","wheel","wheelpicker"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csinac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-03-01T09:58:10.000Z","updated_at":"2021-03-24T18:03:45.000Z","dependencies_parsed_at":"2024-11-18T14:07:46.639Z","dependency_job_id":"eb643696-aea4-4276-be0f-39e69dc1b127","html_url":"https://github.com/csinac/wheel","commit_stats":null,"previous_names":["csinac/wheel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/csinac/wheel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinac%2Fwheel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinac%2Fwheel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinac%2Fwheel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinac%2Fwheel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csinac","download_url":"https://codeload.github.com/csinac/wheel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinac%2Fwheel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260962166,"owners_count":23089361,"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":["chance","opensource-library","unity-asset","unity-editor","unity-tool","unity3d","unity3d-plugin","unity3d-script","wheel","wheelpicker"],"created_at":"2024-11-21T09:08:55.389Z","updated_at":"2025-06-20T14:35:01.608Z","avatar_url":"https://github.com/csinac.png","language":"C#","readme":"# The Wheel of Pseudo Fortune\nThe Wheel of Pseudo Fortune, or just the wheel, is a Unity asset that helps you create a wheel of fortune - either in the UI or in world space.\n\nThe Wheel is constructed in a way that each slot is a subwheel, so you can string rolls (e.g. first roll for a category, then an item, then a rarity level) and create nested probabilities.\n\nThe Wheel provides a callback for the Roll event, to which you can register your own custom functionality. In addition, the example renderers I'll keep adding to this package all inherit the same renderer class, making it highly customizable.\n\n## How to use\n\n```csharp\nWheel wheel = Wheel.Create();\n```\nCreates a new wheel.\n\n```csharp\nwheel.AddSlot(Wheel.Create(chance: 1, name: \"epic_sword\"));\nwheel.AddSlot(Wheel.Create(chance: 3, name: \"rare_sword\"));\nwheel.AddSlot(Wheel.Create(chance: 6, name: \"common_sword\"));\n```\nAdds three slots into the wheel.\n\n```csharp\nWheel filler = Wheel.Create(chance: 20, name: \"filler\");\nfiller.AddSlot(Wheel.Create(name: \"piece_of_rope\"));\nfiller.AddSlot(Wheel.Create(name: \"clothespin\"));\nfiller.AddSlot(Wheel.Create(name: \"sock_with_missing_pair\"));\n\nwheel.AddSlot(filler);\n```\nCreates a new wheel with its own child slots and add this to the main wheel. This will make the original wheel nested, and it will roll for a\n1/30 chance of epic sword\u003cbr /\u003e\n3/30 chance of rare sword\u003cbr /\u003e\n6/30 chance of common sword\u003cbr /\u003e\n20/30 chance of filler materials, where:\u003cbr /\u003e\n-1/3 chance of piece of rope\u003cbr /\u003e\n-1/3 chance of clothespin\u003cbr /\u003e\n-1/3 chance of sock with a missing pair\u003cbr /\u003e\n\nOnce you are happy with the contents of your wheel, you can roll it, like this:\n```csharp\nRollResult result = wheel.Roll();\n```\nResult will contain the selected slot, including the consecutive results if it is a nested wheel.\n\n## Renderers\nThe wheel does not need a renderer to work (see nogui demos). But if you like, you can subscribe arbitrary number of views to it. When finished the project will have four distinctly different renderers to display some diverse ways to render the wheel; Namely the Disk, Grid, Roller and Console 86 (a.k.a. the Brundle Console)\n\nRight now, there are the Disk and the Console 86 renderers are included in this commit.\n\n### How to bind renderers\nEach renderer is composed of a wheel renderer, and an associated unit renderer. Units are the representations of the slots, and the wheel renderer is, well, the representation of the wheel itself. Every renderer derives from WheelRenderer, and each unit derives from UnitRenderer.\n\nEach WheelRenderer has the SetWheel function, which internally subscribes it to the wheel.\n```csharp\nforeach (WheelRenderer renderer in wheelRenderers)\n    if (renderer) renderer.SetWheel(wheel);\n```\nAs an example, if you have an array of renderers, the code above will set each valid renderer's wheel as the given wheel, and everytime the wheel is Rolled, they will automatically be notified.\n\nHere are 4 disk renderers, listening to the same wheel. Two of them have generated meshes, while the other two have imported, fixed meshes. In each pair, one uses text content, while the other uses the non-text, generic content that is defined in the unit renderer associated with the wheel renderer. Namely a sprite and a game object in this example.\n![](ReadmeImg/demoDisks.jpg)\n\n#### Final note\nThis is an ongoing project and new renderers will be added soon.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsinac%2Fwheel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsinac%2Fwheel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsinac%2Fwheel/lists"}