{"id":13786222,"url":"https://github.com/mminer/unity-extensions","last_synced_at":"2025-07-16T14:33:28.626Z","repository":{"id":16542836,"uuid":"19296377","full_name":"mminer/unity-extensions","owner":"mminer","description":"Useful extension methods for Unity.","archived":false,"fork":false,"pushed_at":"2025-06-11T00:49:36.000Z","size":74,"stargazers_count":85,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-11T01:37:27.652Z","etag":null,"topics":["game-development","gamedev","unity","unity-extensions","unity3d"],"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/mminer.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,"zenodo":null}},"created_at":"2014-04-30T00:50:31.000Z","updated_at":"2025-06-11T00:49:40.000Z","dependencies_parsed_at":"2025-01-15T14:18:01.362Z","dependency_job_id":"25d0e644-7cef-486d-90ad-05806afdc8b5","html_url":"https://github.com/mminer/unity-extensions","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/mminer/unity-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mminer%2Funity-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mminer%2Funity-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mminer%2Funity-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mminer%2Funity-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mminer","download_url":"https://codeload.github.com/mminer/unity-extensions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mminer%2Funity-extensions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265518475,"owners_count":23780967,"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":["game-development","gamedev","unity","unity-extensions","unity3d"],"created_at":"2024-08-03T19:01:11.906Z","updated_at":"2025-07-16T14:33:28.615Z","avatar_url":"https://github.com/mminer.png","language":"C#","readme":"# Unity Extensions\n\n[Extension methods](http://en.wikipedia.org/wiki/Extension_method) for Unity\ntypes. If you find yourself thinking \"gee, I wish `GameObject` / `Vector3` /\n`Quaternion` had this method,\" this might be the package for you.\n\n\n## Installing\n\nAdd the package to your project via\n[UPM](https://docs.unity3d.com/Manual/upm-ui.html) using the Git URL:\n\n```\nhttps://github.com/mminer/unity-extensions.git\n```\n\n1. Open the Package Manager window in Unity (*Window \u003e Package Manager*)\n2. Click the \"+\" button in the top-left corner\n3. Select \"Install package from git URL...\"\n4. Enter the above Git URL\n5. Click \"Install\"\n\nAlternatively, add the following line to your `Packages/manifest.json` file:\n\n```json\n{\n  \"dependencies\": {\n    \"com.matthewminer.unity-extensions\": \"https://github.com/mminer/unity-extensions.git\",\n    ...\n  }\n}\n```\n\nYou can also clone the repository and point UPM to your local copy.\n\n\n## Using\n\nThe classes are in the `UnityExtensions` namespace, so you must first import\nthem.\n\n```csharp\nusing UnityExtensions;\n```\n\nNow call the extensions on the appropriate object type.\n\n```csharp\nvoid Awake ()\n{\n    var someComponent = gameObject.GetOrAddComponent\u003cMyComponent\u003e();\n}\n```\n\n\n## Extensions\n\n```csharp\nBounds.RandomPointInside();\n\nColor.WithR(float r);\nColor.WithG(float g);\nColor.WithB(float b);\nColor.WithA(float a);\n\nComponent.AddComponent\u003cT\u003e();\nComponent.AddComponents\u003cT1, T2\u003e();\nComponent.GetComponentsInChildrenIgnoringSelf\u003cT\u003e(bool includeInactive = false);\nComponent.GetOrAddComponent\u003cT\u003e();\nComponent.HasComponent\u003cT\u003e();\nComponent.TryGetComponentInChildren\u003cT\u003e(out T component);\n\nGameObject.AddComponents\u003cT1, T2\u003e();\nGameObject.GetOrAddComponent\u003cT\u003e();\nGameObject.HasComponent\u003cT\u003e();\nGameObject.IsInCullingMask(LayerMask cullingMask);\nGameObject.SetLayerInChildren(int layer);\nGameObject.TryGetComponentInChildren\u003cT\u003e(out T component);\n\nLayerMask.WithLayers(params int[] layers);\nLayerMask.WithLayers(params string[] layerNames);\nLayerMask.WithoutLayers(params int[] layers);\nLayerMask.WithoutLayers(params string[] layerNames);\n\nQuaternion.WithEulerX(float x);\nQuaternion.WithEulerY(float y);\nQuaternion.WithEulerZ(float z);\n\nRigidbody.ChangeDirection(Vector3 direction);\n\nTransform.AddChildren(params GameObject[] children);\nTransform.AddChildren(params Component[] children);\nTransform.Reset(Space space = Space.Self);\nTransform.ResetChildPositions(bool recursive = false);\nTransform.SetChildLayers(string layerName, bool recursive = false);\nTransform.SetLocalPosition(float? x = null, float? y = null, float? z = null);\nTransform.SetPosition(float? x = null, float? y = null, float? z = null);\nTransform.SetX(float x);\nTransform.SetY(float y);\nTransform.SetZ(float z);\n\nVector2.Abs();\nVector2.Ceil();\nVector2.Floor();\nVector2.GetClosest(IEnumerable\u003cVector2\u003e otherPositions);\nVector2.Round();\nVector2.WithX(float x);\nVector2.WithY(float y);\n\nVector2Int.Abs();\nVector2Int.WithX(int x);\nVector2Int.WithY(int y);\n\nVector3.Abs();\nVector3.Ceil();\nVector3.Floor();\nVector3.GetClosest(IEnumerable\u003cVector3\u003e otherPositions);\nVector3.Round();\nVector3.WithX(float x);\nVector3.WithY(float y);\nVector3.WithZ(float z);\n\n// Swizzle operations:\nVector3.XY();\nVector3.XZ();\n// ... and so forth for all combinations.\n\nVector3Int.Abs();\nVector3Int.WithX(int x);\nVector3Int.WithY(int y);\nVector3Int.WithZ(int z);\n\n// Swizzle operations:\nVector3Int.XY();\nVector3Int.XZ();\n// ... and so forth for all combinations.\n\nVector4.Abs();\nVector4.Ceil();\nVector4.Floor();\nVector4.Round();\nVector4.WithX(float x);\nVector4.WithY(float y);\nVector4.WithZ(float z);\nVector4.WithW(float w);\n```\n","funding_links":[],"categories":["Extension Methods"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmminer%2Funity-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmminer%2Funity-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmminer%2Funity-extensions/lists"}