{"id":21815239,"url":"https://github.com/doyasu24/serializablefieldassertions","last_synced_at":"2026-05-19T00:02:38.122Z","repository":{"id":264980774,"uuid":"894798180","full_name":"doyasu24/SerializableFieldAssertions","owner":"doyasu24","description":"SerializableFieldAssertions provides simple assertion methods for serializable fields with readable error messages in Unity.","archived":false,"fork":false,"pushed_at":"2024-11-27T05:24:45.000Z","size":459,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T09:48:03.781Z","etag":null,"topics":["assert","null-check","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/doyasu24.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-11-27T02:27:51.000Z","updated_at":"2024-11-27T05:24:36.000Z","dependencies_parsed_at":"2025-03-21T09:45:48.002Z","dependency_job_id":"576a8ab6-22b7-42ac-9729-e71f9b197715","html_url":"https://github.com/doyasu24/SerializableFieldAssertions","commit_stats":null,"previous_names":["doyasu24/serializablefieldassertions"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/doyasu24/SerializableFieldAssertions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doyasu24%2FSerializableFieldAssertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doyasu24%2FSerializableFieldAssertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doyasu24%2FSerializableFieldAssertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doyasu24%2FSerializableFieldAssertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doyasu24","download_url":"https://codeload.github.com/doyasu24/SerializableFieldAssertions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doyasu24%2FSerializableFieldAssertions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33196091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["assert","null-check","unity"],"created_at":"2024-11-27T15:16:58.942Z","updated_at":"2026-05-19T00:02:38.092Z","avatar_url":"https://github.com/doyasu24.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serializable Field Assertions\n\nProvides simple assertion methods for serializable fields with readable error messages in Unity.\n\n```cs\nusing System;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing SerializableFieldAssertions;\n\npublic class SampleComponent : MonoBehaviour\n{\n    // UnityEngine.Object marked as [SerializeField] is serialized, and it can be null.\n    [SerializeField] private GameObject myGameObject = null!;\n    // public field UnityEngine.Object is serialized, and it can be null.\n    public Transform MyTransform = null!;\n    // T[] where T : UnityEngine.Object can contain null elements, but the array itself cannot be null.\n    [SerializeField] private Transform[] myTransformArray = null!;\n\n    private void Awake()\n    {\n        // Asserts that all serializable fields are not null with readable message.\n        // \n        // --- output example ---\n        // AssertionException: SampleComponent.myGameObject is null.\n        // Hierarchy: MyGameObject\n        // Scene: TestScene\n        // \n        // --- output example (Array or List) ---\n        // AssertionException: SampleComponent.myTransformArray contains null elements.\n        // Index: 0\n        // Hierarchy: MyGameObject\n        // Scene: TestScene\n        SerializableFieldAssert.AreNotNullAll(this);\n\n        // Asserts that specified serializable field is not null with readable message.\n        SerializableFieldAssert.IsNotNull(this, nameof(myGameObject));\n    }\n}\n```\n\n![error-message](./doc/images/error-message.png)\n\n## Features\n\nBy calling `SerializableFieldAssert.AreNotNullAll(this);` in the `Awake` method of a `Component`, you can assert that all serializable fields, such as those marked with `[SerializeField]`, are not null.\n\n```cs\nprivate void Awake()\n{\n    // Asserts that all serializable fields are not null.\n    SerializableFieldAssert.AreNotNullAll(this);\n}\n```\n\nThe assertion is marked with `[Conditional(\"UNITY_ASSERTIONS\")]`, the same as `UnityEngine.Assertions.Assert.IsNotNull`, so assertions are disabled in release build.\n\n### Nullable fields\n\nIf you want to allow null values for a specific field, you can use the nullable type like `UnityEngine.Object?`.\n\n`SerializableFieldAssert.AreNotNullAll` does not validate fields that are nullable types.\n\n```cs\n// This field is validated for null by `SerializableFieldAssert.AreNotNullAll`.\n[SerializeField] private GameObject myGameObject = null!;\n// This field is not validated for null by `SerializableFieldAssert.AreNotNullAll`.\n[SerializeField] private GameObject? nullableGameObject = null;\n```\n\nFor more details about serializable fields, refer to the official documentation:\n\n[Unity - Manual: Script serialization](https://docs.unity3d.com/2022.3/Documentation/Manual/script-Serialization.html)\n\n## Install\n\nYou can add https://github.com/doyasu24/SerializableFieldAssertions.git?path=Assets/Plugins/SerializableFieldAssertions#0.1.0 to Package Manager.\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoyasu24%2Fserializablefieldassertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoyasu24%2Fserializablefieldassertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoyasu24%2Fserializablefieldassertions/lists"}