# Automatic Mesh Validation

{% hint style="info" %}
The following feature was added in release v40
{% endhint %}

## Summary

We have added a mesh validation step to cooks, and upon saving `StaticMesh` and `SkeletalMesh` assets. If you are building for mobile (i.e. your `.uproject` has a `IOS` or `Android` related target platform), these checks will be run, to make sure your meshes will be performant to use.

At the point that you save when in-editor, it will check that enough `LOD` levels have been generated. If there are too few, some will be made automatically.

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-f7e4de6e828aab5f695da6004d5a40bb1c21e4fd%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

The checks will also be run when you cook your project (either in-editor, or externally, e.g. via CI). If assets exist that fail the mesh validation checks (i.e. they have too few `LOD` levels), the assets will be flagged. These assets will need to be fixed (they aren't fixed up automatically here, but can be fixed in-editor afterwards, e.g. by re-saving them)

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-37f7e0cebc272c850034915d1f77251c2575dc8d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
NOTE: If your project is not targeting mobile platforms, this feature won't affect you by default. If you want the checks (and automatic fixes) to apply to your project, you can uncheck the `Only Validate on Mobile` flag.

For more details, see [#configuring-the-mesh-validation](#configuring-the-mesh-validation "mention")below.
{% endhint %}

## Configuring the mesh validation

The mesh validation settings can be found in `Project Settings | M2 World Builder | Mesh Validation`. These can be freely configured to fit your project:

<figure><img src="https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-02d011827d8653a081a8bb16c27aaa1a5c3ff9bb%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

* `Validate Meshes` - controls whether the validation steps will be run at all. If this is false, all the settings below it are ignored.
* `Only Validate on Mobile` - true by default. If set, the validation steps will only be run if you have a mobile platform in your "Target Platforms" list in your `.uproject` file. If the value is false, then we won't check platforms, and will run the checks on all of them.
  * E.g. this example contains `IOSClient`, so we will validate even if `Only Validate on Mobile` is true.\
    ![](https://1456550285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoWTlPaoHd1McSakqMigu%2Fuploads%2Fgit-blob-c7e17fbf19c37e9102cbbbee903694bedfee311e%2Fimage.png?alt=media)
  * The reasoning here is that projects that aren't intending to run on mobile may not need these LOD checks - the performance requirements on PC are not as severe, and nanite exists to handle performant meshes at different distances without LODs.
* `Auto-LOD Meshes` - if this is true, then when you save meshes in-editor, if they fail the validation check, the required number of LODs will automatically be created for you.
* `Max Vertices Before Needing LODs` - if a mesh has fewer vertices than this, then we don't bother enforcing a minimum number of LODs (e.g. if we have a model that is already very low-poly, it won't need multiple LODs)
* `Min Static Mesh LODs` - how many LODs to require a large static mesh has.
* `Min Skeletal Mesh LODs` - how many LODs to require a large skeletal mesh has.
