Asset Validator is an editor tool which checks all assets and scenes in a project, ensuring correct and optimal configuration of prefab components, materials, textures, audio clips, scriptable objects, and more. It does this through a powerful validation framework that is fully customizable, and also integrates as a unit test into continuous integration tools such as Jenkins.
Asset validation is an important part of any project, but particularly as one grows in assets and team size. Automatically ensuring proper configuration not only saves time debugging issues, but also often leads to major savings in runtime memory, load times, and build size.
Included are pre-written validators to check for missing components, duplicate components, large textures, or assets marked Read/Write when they shouldn't be; these are easily over-ridable and customizable. In addition, this package also adds helpful C# attributes such as [Required] to ensure a field is assigned a non-empty value, and [ResourcePath] to ensure a field is a string or object of an asset in a Resources folder, facilitating Unity best practices.
The validators in this package can be categorized as 3 kinds:
Asset validators - For validating any asset type such as materials, textures, audio clips, or scriptable objects.
Component validators - For validating components on prefabs or objects within scenes.
Field validators - For validating component fields such as the above-mentioned [Required] and [ResourcePath] attributes. These are also conveniently validated in real-time in the Inspector, rendering the field in red if there is an error.
Asset Validator是一个编辑器工具,用于检查项目中的所有资产和场景,确保预制组件、材质、纹理、音频剪辑、可脚本化对象等的正确和最佳配置。它通过一个功能强大的验证框架来实现这一点,该框架完全可定制,并作为单元测试集成到Jenkins等持续集成工具中。
资产验证是任何项目的重要组成部分,尤其是随着资产和团队规模的增长。自动确保正确的配置不仅可以节省调试问题的时间,而且通常还可以节省运行时内存、加载时间和构建大小。
包括预先编写的验证器,用于检查缺失的组件、重复的组件、大纹理或标记为读/写的资产(当它们不应该被标记时);这些很容易被过度使用和定制。此外,此包还添加了有用的C#属性,如[Required],以确保字段被分配一个非空值,以及[ResourcePath],以确保字段是Resources文件夹中资产的字符串或对象,从而促进Unity的最佳实践。
此包中的验证器可分为3类:
资产验证器-用于验证任何资产类型,如材质、纹理、音频剪辑或可脚本化对象。
组件验证器-用于验证场景中预制件或对象上的组件。
字段验证器-用于验证组件字段,如上述[Required]和[ResourcePath]属性。这些也可以在Inspector中方便地实时验证,如果出现错误,字段将显示为红色。
|