{"id":14961042,"url":"https://github.com/solidalloy/solidutilities","last_synced_at":"2025-10-24T20:30:49.483Z","repository":{"id":89551007,"uuid":"297379204","full_name":"SolidAlloy/SolidUtilities","owner":"SolidAlloy","description":"Different utilities that simplify development in Unity3D.","archived":false,"fork":false,"pushed_at":"2023-11-02T18:16:08.000Z","size":459,"stargazers_count":30,"open_issues_count":7,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T03:55:43.401Z","etag":null,"topics":["unity","unity3d","upm","upm-package","util","utiltity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SolidAlloy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-09-21T15:17:56.000Z","updated_at":"2024-11-08T02:38:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"7089cb5d-c60b-4eb8-9e67-b1b727894eec","html_url":"https://github.com/SolidAlloy/SolidUtilities","commit_stats":{"total_commits":288,"total_committers":5,"mean_commits":57.6,"dds":0.4444444444444444,"last_synced_commit":"71ceb90f6a772d5a74a9357d5f1a801e6b0bea8f"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidAlloy%2FSolidUtilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidAlloy%2FSolidUtilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidAlloy%2FSolidUtilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidAlloy%2FSolidUtilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SolidAlloy","download_url":"https://codeload.github.com/SolidAlloy/SolidUtilities/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238030288,"owners_count":19404859,"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":["unity","unity3d","upm","upm-package","util","utiltity"],"created_at":"2024-09-24T13:23:42.623Z","updated_at":"2025-10-24T20:30:49.109Z","avatar_url":"https://github.com/SolidAlloy.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SolidUtilities\n[![openupm](https://img.shields.io/npm/v/com.solidalloy.util?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.solidalloy.util/)\n\nDifferent utilities that simplify development in Unity3D. They include extensions for common Unity structures such as Rect and Texture2D, different methods that make it easier to develop custom interfaces and property drawers, etc.\n\nYou can read the full documentation on the repository [Wiki](https://github.com/SolidAlloy/SolidUtilities/wiki).\n\nI'm adding new utilities as I write code for other Unity3D projects and discover some common patterns/methods I use throughout the codebase.\n\n#### Projects that use SolidUtilities:\n\n- [ClassTypeReference-for-Unity](https://github.com/SolidAlloy/ClassTypeReference-for-Unity)\n- [Generic Unity Objects](https://github.com/SolidAlloy/GenericUnityObjects)\n  \n\n### Install with OpenUPM\n\nOnce you have the [OpenUPM cli](https://github.com/openupm/openupm-cli#installation), run the following command:\n\n```openupm install com.solidalloy.util```\n\nOr if you don't have it, add the scoped registry to manifest.json with the desired dependency semantic version: \n\n```json\n  \"scopedRegistries\": [\n    {\n      \"name\": \"package.openupm.com\",\n      \"url\": \"https://package.openupm.com\",\n      \"scopes\": [\n        \"com.solidalloy\",\n        \"com.openupm\"\n      ]\n    }\n  ],\n  \"dependencies\": {\n    \"com.solidalloy.util\": \"1.39.0\"\n  },\n\n```\n\n### Install via Package Manager\n\nProject supports Unity Package Manager. To install the project as a Git package do the following:\n\n1. In Unity, open **Project Settings** -\u003e **Package Manager**.\n2. Add a new scoped registry with the following details:\n   - **Name**: package.openupm.com\n   - **URL**: https://package.openupm.com\n   - Scope(s):\n     - com.openupm\n     - com.solidalloy\n3. Hit **Apply**.\n4. Go to **Window** -\u003e **Package Manager**.\n5. Press the **+** button, *Add package from git URL*.\n6. Enter **com.solidalloy.util**, press **Add**.\n\n# The most useful utilities\n\n## RectExtensions\n\n### AddHorizontalPadding(rect, leftPadding, rightPadding)\n\nCreates padding to the left and right of a rectangle by narrowing it down.\n\n| Name | Description |\n| ---- | ----------- |\n| rect | *UnityEngine.Rect*\u003cbr\u003eThe bigger rect to create padding for. |\n| leftPadding | *System.Single*\u003cbr\u003eWidth of the left padding in pixels. |\n| rightPadding | *System.Single*\u003cbr\u003eWidth of the right padding in pixels. |\n\n#### Returns\n\nThe smaller rect that appeared after creating paddings.\n\n#### Example\n\n\n```\nRect innerToolbarArea = outerToolbarArea.AddHorizontalPadding(10f, 2f);\n```\n\n\n### AlignMiddleVertically(rect, height)\n\nPlaces a rect with a smaller height vertically in the middle of a bigger rect.\n\n| Name | Description |\n| ---- | ----------- |\n| rect | *UnityEngine.Rect*\u003cbr\u003eThe bigger rect. |\n| height | *System.Single*\u003cbr\u003eThe height of a smaller rect. |\n\n#### Returns\n\nThe smaller rect with a given height that was aligned vertically in the middle of a bigger rect.\n\n#### Example\n\n\n```\nRect innerToolbarArea = outerToolbarArea.AlignMiddleVertically(DropdownStyle.LabelHeight);\n```\n\n\n### CutVertically(originalRect, cutDistance, fromRightBorder)\n\nCuts a big rect into two smaller ones by placing a vertical cut at cutDistance from the left or right border of the rect.\n\n| Name | Description |\n| ---- | ----------- |\n| originalRect | *UnityEngine.Rect*\u003cbr\u003eThe rect that should be split. |\n| cutDistance | *System.Single*\u003cbr\u003eThe distance from the left or right border of the rect where to place vertical cut. |\n| fromRightBorder | *System.Boolean*\u003cbr\u003eWhether to count the distance from left or right border. |\n\n#### Returns\n\nLeft and right rects that appeared after the cut.\n\n#### Example\n\n\n```\n(Rect searchFieldArea, Rect buttonArea) = innerToolbarArea.CutVertically(DropdownStyle.IconSize, true);\n```\n\n\n### RoundUpCoordinates(rect)\n\nRounds up x, y, width, and height of the rect.\n\n| Name | Description |\n| ---- | ----------- |\n| rect | *UnityEngine.Rect@*\u003cbr\u003eRect to round coordinates for. |\n\n#### Example\n\n\n```\npopupArea.RoundUpCoordinates();\n```\n\n## FuzzySearch\n\nImplementation of the fuzzy search algorithm.\n\n### CanBeIncluded(searchString, itemName, score)\n\nDetermines if an item should be included in the search result and outputs its score (its position in the list of matching items.)\n\n| Name | Description |\n| ---- | ----------- |\n| searchString | *System.String*\u003cbr\u003eSearch string to compare the item to. |\n| itemName | *System.String*\u003cbr\u003eName of the item to include in the result list. |\n| score | *System.Int32@*\u003cbr\u003eScore of the item that determines how high in the result list it should be placed. |\n\n#### Returns\n\nWhether to include the result in the list.\n\n#### Example\n\n\n```\nEnumerateTree()\n    .Where(node =\u003e node.Type != null)\n    .Select(node =\u003e\n    {\n        bool includeInSearch = FuzzySearch.CanBeIncluded(_searchString, node.FullTypeName, out int score);\n        return new { score, item = node, include = includeInSearch };\n    })\n    .Where(x =\u003e x.include)\n    .OrderByDescending(x =\u003e x.score)\n    .Select(x =\u003e x.item));\n```\n## DrawHelper\n\nDifferent useful methods that simplify \u003ca href=\"#unityengine.guilayout\"\u003eUnityEngine.GUILayout\u003c/a\u003e API.\n\n### DrawHorizontally(drawContent)\n\nDraws content in the horizontal direction.\n\n| Name | Description |\n| ---- | ----------- |\n| drawContent | *System.Action*\u003cbr\u003eAction that draws the content. |\n\n#### Example\n\n\n```\nDrawHelper.DrawHorizontally(() =\u003e\n{\n    selectedValue = DrawSelectorDropdownAndGetSelectedValue();\n\n    if (Event.current.type == EventType.Repaint)\n        DrawHamburgerMenuButton();\n});\n```\n\n\n### DrawVertically(drawContent)\n\nDraws content in the vertical direction.\n\n| Name | Description |\n| ---- | ----------- |\n| drawContent | *System.Action*\u003cbr\u003eAction that draws the content. |\n\n#### Example\n\n\n```\nDrawHelper.DrawVertically(() =\u003e\n{\n    EditorDrawHelper.DrawInfoMessage(\"No types to select.\");\n});\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidalloy%2Fsolidutilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidalloy%2Fsolidutilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidalloy%2Fsolidutilities/lists"}