{"id":14960466,"url":"https://github.com/lazysquirrellabs/min_max_range_attribute","last_synced_at":"2025-05-02T13:30:25.117Z","repository":{"id":203554256,"uuid":"709876087","full_name":"lazysquirrellabs/min_max_range_attribute","owner":"lazysquirrellabs","description":"A bounded (i.e., with a minimum and maximum) range attribute for Unity's Vector2 and Vector2Int fields.","archived":false,"fork":false,"pushed_at":"2025-04-20T07:33:44.000Z","size":552,"stargazers_count":22,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T07:39:45.949Z","etag":null,"topics":["game-development","gamedev","unity","unity-editor","unity-tools","unity3d-plugin"],"latest_commit_sha":null,"homepage":"http://minmax.matheusamazonas.net","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/lazysquirrellabs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-25T15:11:38.000Z","updated_at":"2025-04-15T16:49:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"86628cbc-df81-4689-9a28-69f6d9374b53","html_url":"https://github.com/lazysquirrellabs/min_max_range_attribute","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"268285357232ce048ebe90dae7ca27a2808c6254"},"previous_names":["matheusamazonas/min_max_range_attribute"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazysquirrellabs%2Fmin_max_range_attribute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazysquirrellabs%2Fmin_max_range_attribute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazysquirrellabs%2Fmin_max_range_attribute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazysquirrellabs%2Fmin_max_range_attribute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lazysquirrellabs","download_url":"https://codeload.github.com/lazysquirrellabs/min_max_range_attribute/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252045991,"owners_count":21685931,"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-editor","unity-tools","unity3d-plugin"],"created_at":"2024-09-24T13:22:20.826Z","updated_at":"2025-05-02T13:30:25.101Z","avatar_url":"https://github.com/lazysquirrellabs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Min/max Range Attribute\n![openupm](https://img.shields.io/npm/v/com.lazysquirrellabs.minmaxrangeattribute?label=openupm\u0026registry_uri=https://package.openupm.com) \n\nA bounded (i.e., with a minimum and maximum) range attribute for Unity's `Vector2` and `Vector2Int` fields that draws fields as min/max range sliders, easing the definition of bounded ranges on the inspector.\n\n![Five examples of attribute usage on the Unity inspector.](https://minmax.lslabs.dev/assets/images/header.gif)\n\n[![](https://minmax.lslabs.dev/assets/images/get_unity.webp)](https://assetstore.unity.com/packages/tools/utilities/min-max-range-attribute-302500)\n\n## Features\n- Intuitive, compact inspector representation.\n- Support for Unity's `Vector2` and `Vector2Int` types.\n- Easy to use: just add the attribute to a serialized field of a supported type.\n- Custom floating-point decimal places (0 to 3).\n- Error prevention. Unlike using separate fields for minimum and maximum, value integrity is guaranteed (e.g., the minimum will never be greater than the maximum) by the inspector.\n- Uses built-in Unity's  [`EditorGUILayout.MinMaxSlider`](https://docs.unity3d.com/ScriptReference/EditorGUILayout.MinMaxSlider.html) under the hood.\n\n\n## Usage\nTo use the attribute, simply add it to a serialized field of a supported type (`Vector2` or `Vector2Int`). Its inspector representation will be a [`MinMaxSlider`](https://docs.unity3d.com/ScriptReference/EditorGUILayout.MinMaxSlider.html), a slider than can be used to represent a range within minimum and maximum limits. The left handle controls the vector's `x` component and the right handle controls the vector's \n\n### Vector2 usage\nWhen using the attribute on a field of type `Vector2`, its constructor takes 3 arguments:\n- `minLimit`: the minimum possible value (lower bound).\n- `maxLimit`: the maximum possible value (upper bound).\n- `decimals`: how many decimal places the inspector should display. Default is 1 and values must be in the [0, 3] range.\n\nFor example, the field below has `minLimit` equal to 0, `maxLimit` equal to 10 and `decimals` equal to 3:\n```csharp\n[MinMaxRange(0f, 10f, 3)]\n[SerializeField] private Vector2 _optimalSpeed = new (3.141f, 5.789f);\n```\n\nAnd its inspector representation is:\n\n![](https://minmax.matheusamazonas.net/assets/images/usage/vector_3.png)\n\nIf `decimals` is 2 (`MinMaxRange(0f, 10f, 2)`):\n\n![](https://minmax.matheusamazonas.net/assets/images/usage/vector_2.png)\n\nThe default value of `decimals` is 1, so we might as well omit the parameter if we would like to display only 1 decimal place:\n```csharp\n[MinMaxRange(0f, 10f)]\n[SerializeField] private Vector2 _optimalSpeed = new (3.141f, 5.789f);\n```\n\nWhich will be displayed as:\n\n![](https://minmax.matheusamazonas.net/assets/images/usage/vector_1.png)\n\nKeep in mind that the `decimals` parameter only controls how the value labels will be displayed on the inspector. It doesn't control the values' precision.\n\n### Vector2Int usage\nWhen using the attribute on a field of type `Vector2Int`, its constructor takes 2 arguments, similar to `RangeAttribute`'s parameters:\n- `minLimit`: the minimum possible value (lower bound).\n- `maxLimit`: the maximum possible value (upper bound).\n\nFor example, the field below has `minLimit` equal to 0 and `maxLimit` equal to 10:\n```csharp\n[MinMaxRange(0, 10)]\n[SerializeField] private Vector2Int _rewardRange = new(2, 4);\n```\nAnd its inspector representation is:\n\n![](https://minmax.matheusamazonas.net/assets/images/usage/vector_int.png)\n\n## Importing\nThe first step is to import the library into your Unity project. There are three ways to do so: \n- [Via the Asset Store](#import-via-unity-asset-store).\n- Via the Package Manager:\n\t- [Using a git URL](#import-using-a-git-url). \n\t- [Using OpenUPM](#import-with-openupm).\n\n### Import via Unity Asset Store\nClick on the image below to visit the package's page on the Unity Asset Store. One there, follow the instructions to import it into your project.\n\n[![](https://minmax.lslabs.dev/assets/images/get_unity.webp)](https://assetstore.unity.com/packages/tools/utilities/min-max-range-attribute-302500)\n\n### Import using a git URL\nThis approach uses Unity's Package Manager to add the attribute to your project using the repo's git URL. To do so, navigate to `Window \u003e Package Manager` in Unity. Then click on the `+` and select \"Add package from git URL\":\n\n![](https://minmax.matheusamazonas.net/assets/images/upm_adding.png)\n\nNext, enter the following in the \"URL\" input field to install the latest version of the attribute:\n```\nhttps://github.com/lazysquirrellabs/min_max_range_attribute.git?path=Assets/Lazy Squirrel Labs/MinMaxRangeAttribute\n```\nFinally, click on the \"Add\" button. The importing process should start automatically. Once it's done, the attribute can be used in your project. \n\n### Import with OpenUPM\nMin/max Range Attribute is available as a package on [OpenUPM](https://openupm.com/packages/com.lazysquirrellabs.minmaxrangeattribute/). To import it into your project via the command line, run the following command:\n```\nopenupm add com.lazysquirrellabs.minmaxrangeattribute\n```\nOnce the importing process is complete, the attribute can be used in your project. \n\n## Compatibility and dependencies\nThe Min/max Range Attribute requires Unity 2021.3.X or above, its target API compatibility level is .NET Standard 2.1, and it does not depend on any other packages.\n\n## Contributing\nIf you would like to report a bug, please create an [issue](https://github.com/lazysquirrellabs/min_max_range_attribute/issues). If you would like to contribute with bug fixing or small improvements, please open a Pull Request. If you would like to contribute with a new feature,  [contact the developer](https://matheusamazonas.net/contact.html).  \n\n## Getting help\nUse the [issues page](https://github.com/lazysquirrellabs/min_max_range_attribute/issues) if there's a problem with your setup, if something isn't working as expected, or if you would like to ask questions about the tool and its usage.\n\n## License\nMin/max Range Attribute is distributed under the terms of the MIT license. For more information, check the [LICENSE](https://github.com/lazysquirrellabs/min_max_range_attribute/blob/main/LICENSE) file in this repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazysquirrellabs%2Fmin_max_range_attribute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazysquirrellabs%2Fmin_max_range_attribute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazysquirrellabs%2Fmin_max_range_attribute/lists"}