Skip to content

ValueValidators

Leon Kirschbaum edited this page Nov 13, 2022 · 6 revisions

ValueValidators

ValueValidators target all values of the specified type, regardless of where they are used. They are great if you want to validate non-unity objects, such as strings, structs, or classes.

Table Of Contents

Texture2D Validator

How Does This Validator Work?

The Texture2D Validator checks all assets of type Texture2D. Currently it checks if the Sprite Mesh Type of the Texture2D asset is Full-Rect. If so, the fix changes the Sprite Mesh Type from Full-Rect to Tight and reimports the asset.

Why Does This Improve Performance?

If the Mesh Type is Full-Rect, Unity will render the sprite as a full quad with transparent regions. Using the Mesh Type Tight will eliminate the transparent regions thus you render fewer pixel. To use this the image type must be set to Simple and the Use sprite mesh toggle must be enabled, which is covered by the Image Validator.

For more information about Sprite Mesh Types click here.

Camera.main Validator - CURRENTLY NOT WORKING!

How Does This Validator Work?

The Camera.main Validator checks all assets, that end with .cs and reads the code line by line if Camera.main is used and checks all GameObjects in the currently active scene that have a script attached which is uses Camera.main.

Why Does This Improve Performance?

Calling Camera.main is a performance heavy call. Unity searches for the Camera, which has the Main Camera tag, in the currently active scene.