{"id":23752364,"url":"https://github.com/incantium/required","last_synced_at":"2026-02-10T16:31:26.365Z","repository":{"id":267855361,"uuid":"896966700","full_name":"Incantium/Required","owner":"Incantium","description":"Make your Unity reference fields required, so they always must be set.","archived":false,"fork":false,"pushed_at":"2025-01-24T13:25:17.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-20T21:52:23.509Z","etag":null,"topics":["attribute","csharp","developer-tool","package","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/Incantium.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":"2024-12-01T18:32:36.000Z","updated_at":"2025-01-24T13:25:21.000Z","dependencies_parsed_at":"2024-12-12T21:29:13.873Z","dependency_job_id":"f6282254-8f98-4452-8daf-0a704e6f3d44","html_url":"https://github.com/Incantium/Required","commit_stats":null,"previous_names":["incantium/required"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incantium%2FRequired","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incantium%2FRequired/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incantium%2FRequired/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incantium%2FRequired/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Incantium","download_url":"https://codeload.github.com/Incantium/Required/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239921877,"owners_count":19718842,"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":["attribute","csharp","developer-tool","package","unity"],"created_at":"2024-12-31T17:28:42.957Z","updated_at":"2026-02-10T16:31:26.322Z","avatar_url":"https://github.com/Incantium.png","language":"C#","readme":"# Required\n\n![Unity version](https://img.shields.io/badge/2022.3+-cccccc?logo=unity)\n![.NET version](https://img.shields.io/badge/Standard_2.1-5027d5?logo=dotnet)\n![C# version](https://custom-icon-badges.demolab.com/badge/9.0-67217a?logo=cshrp)\n\n## Overview\n\n![Required example](Images~/Required%20example.png)\n\nOne of the most common errors in any Unity project are the \n[`NullReferenceException`](https://learn.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=net-9.0), \nhaunting developers nightmares. This package makes it easier to spot when a serialized fields in the Unity Editor is \nleft empty, even though they should be set. With this new `[Required]` attribute, you (as a software developer) can be \nsure required fields in the Unity Editor are communicate with your team members, no matter what.\n\n## Installation instructions\n\n- Open the [Package Manager](https://docs.unity3d.com/Manual/upm-ui.html) in a Unity project.\n- Click on the \"+\" button to add a new package.\n- Click on \"Install package from git URL...\".\n- Put in `https://github.com/Incantium/Required.git`.\n- Click on \"Install\" or press enter.\n- Enjoy!\n\n## Limitations\n\n- It is impossible to reference classes that cannot be referenced through the Unity Editor (that do not inherit from\n  [Object](https://docs.unity3d.com/ScriptReference/Object.html) or [IRequireable](API~/IRequireable.md)).\n\n## Workflow\n\nTo make any referenceable field required in Unity, you only have to do the following.\n\n```csharp\nusing Incantium.Attributes;\nusing UnityEngine;\n\npublic class ExampleClass : MonoBehaviour\n{\n    [SerializeField]\n    [Tooltip(\"The target position of the enemy. Not setting this field will give a warning in the Unity Editor.\")]\n    [Required]\n    private Transform target;\n}\n```\n\n## References\n\n| Class                                  | Description                                                                          |\n|----------------------------------------|--------------------------------------------------------------------------------------|\n| [IRequireable](API~/IRequireable.md)   | Interface for other classes able to be required.                                     |\n| [Required](API~/Required.md)           | The Required attribute to show a warning in the Unity Editor when found to be empty. |\n| [RequireStatus](API~/RequireStatus.md) | The different statuses a required field can be in.                                   |\n\n## Frequently Asked Questions\n\n### Which Unity versions are compatible with this package?\n\nThis package is heavily tested in `Unity 2022.3.44f1` and `Unity 6000.0.25f1`. It is expected that this package also\nworks in older and newer versions of the Unity Editor because it is not dependent on any other Unity package.\n\n### Why does a warning appear when I use Required?\n\n![Non-referenceable](Images~/Non-referenceable.png)\n\nThis warning shows up when the field to be required is not referenceable through the Unity Editor (like all primitive \ndata structures such as integers, floats, and booleans). Only the classes inherited from\n[Object](https://docs.unity3d.com/ScriptReference/Object.html) are referenceable through the Unity Editor. The exception\nis the [IRequireable](API~/IRequireable.md) interface, which also makes it possible to be required.\n\n### It is possible for custom classes to be requireable?\n\nYes. It is possible for classes that don't inherit from\n[Object](https://docs.unity3d.com/ScriptReference/Object.html) to be requireable, such as\n[serializable](https://learn.microsoft.com/en-us/dotnet/api/system.serializableattribute?view=net-9.0) classes. These\nclasses need to implement the [IRequireable](API~/IRequireable.md) interface to function properly with the Required \nattribute.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincantium%2Frequired","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincantium%2Frequired","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincantium%2Frequired/lists"}