How do I determine which object this error refers to?

How do I determine which object this error refers to?
It’s just an ever-present message that I have no idea which object it is referencing.

“Mesh has no UV (texture coordinates) data.
UnityEditor.PostprocessScene:GenerateStaticBatches()”

No ideas?

It refers to the mesh you imported that you didn’t apply UV mapping to. :slight_smile:

But no, there’s no way to tell which object it refers to. It refers to -a- mesh, but in my experience it’s impossible to tell which one.

Well thanks for the confirmation… :lol:

I have this error now, and I don’t know which mesh, This is clearly annoying as I have to check a lot of assets now.

Well, you could write an editor script that does something like this:

foreach(MeshFilter mf in FindSceneObjectsOfType(typeof(MeshFilter)))
{
  if(!mf.sharedMesh) continue;
  var uvs = mf.sharedMesh.uv;
  if(uvs == null || uvs.Length == 0)
    Debug.Log("MeshFilter " + mf.name + " has a mesh " + mf.sharedMesh.name + " with no UV coordinates.", mf);
}

Thanks but I can’t write something like that, or do you mean this already is the script?

I didn’t test it, but I think it works as-is, yeah.

You’ll need to put it in an editor script. Make a new .cs file called CheckForMissingUVs.cs, and put it inside a folder called ‘Editor’ in your project. Then put in all the following code (which, again, I’ve not tested and am writing directly into this post, but I think it’ll work):

using UnityEditor;
using UnityEngine;

public class CheckForMissingUVs
{
  [MenuItem("Edit/Check for missing UVs")]
   public static void DoCheck()
   {
      /* Code from my earlier post here */
      foreach(MeshFilter mf in Object.FindSceneObjectsOfType(typeof(MeshFilter)))
      {
        if(!mf.sharedMesh) continue;
        var uvs = mf.sharedMesh.uv;
        if(uvs == null || uvs.Length == 0)
          Debug.Log("MeshFilter " + mf.name + " has a mesh " + mf.sharedMesh.name + " with no UV coordinates.", mf);
      }
   }
}

Save, return to Unity, and wait for it to recompile. When it’s finished, there should be a new item in Unity’s “Edit” menu named “Check for missing UVs”. Pick that, and any meshes with missing UVs (that are used in a MeshFilter in the scene) will be logged to the console.

Thanks for helping, I get one error

Assets/Editor/CheckForMissingUVs.cs(19,32): error CS0103: The name `FindSceneObjectsOfType’ does not exist in the current context

Oh, right. Add “Object.” before it.

[edited the code above to reflect the fix]

Works perfect !

Many thanks saved my day.