Since Unity 4.0, the innocent “Shader wants tangents, but the mesh doesn’t have them” error, that used to pop up like once, but didn’t seem to cause any harm whatsoever, has turned into a major enemy of the system.
I get several thousand of them per minute (like one per object per frame), and my game runs at a crawl (okay, my game -crawls-).
Now the message neither gives any clues as to which shader causes this, or which mesh is the one in question. In any case, everything renders fine, so wherever the problem is, it doesn’t matter, or rather, it wouldn’t, if Unity could just shut up about it.
So I did identify a few potential culprits (e.g. a mesh that I create and update dynamically at runtime). I also found a script here that calculates the tangents. Obviously it must be more objects than the dynamic one, since the message still shows up thousandfold. But also, the script is several times slower than the script that generates the mesh and uvs and normals in the first place, so it’s close to unusable for me.
I also have a few shaders that could be causing the problem. They’re made with strumpy’s shader editor, and I have no idea what causes a shader to need tangents. I would have suspected doing something with the normals, as a bump shader would do, which I don’t. The closest thing I’m using is the NormalizedScreenPosition, which I doubt causes this.
I’ve been at it since Unity 4 is out and I’m at a loss. So hopefully someone has an idea how to tackle this. (e.g. someone working for Unity, who can just turn off the message and roll out an update
)