-
Notifications
You must be signed in to change notification settings - Fork 1
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. Let's go trough an example to see how they 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.
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.
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.
Calling Camera.main is a performance heavy call. Unity searches for the Camera, which has the Main Camera tag, in the currently active scene.