A lot of our projects and products rely on our custom GPU renderer based on Graphics.DrawMeshInstanced calls to render models efficiently. Now suddenly after +8 years of working with this API, in Unity 2021.3.9 we receive this error:
However the models are still being rendered properly but this error spams the console and makes the projects unusable. This also leads to a state where even none of Unity’s own standard shaders working and receiving the same error!
Since our solution was based on DrawMeshInstanced and we chose this to avoid needing to touch any shader codes whether it’s a custom shader or Unity’s and was working on all shaders by default, but it broke the entire ideology and affected our development heavily.
So guides and hints on this from Unity graphics staff is strongly needed here since I guess it affected a lot of users.
Hi!
We used to silently ignore this (shader not reading any instanced properties and using instanced rendering). This lead to incorrect behaviour when used. After this fix it’s promptly issuing an error.
Thanks for the heads up on this. For the past few days, we were trying to sync an instanced shader with DrawMeshInstanced without receiving this error but none worked. It is really appreciated if you could share a simple instanced shader which works without errors since we tried every possible instancing data in shaders but failed!
And by this, you mean even none of Unity’s built-in shaders will work with DrawMeshInstanced anymore! That’s sad to hear!
OK, looks like we found the culprit. It doesn’t find any instanced properties when it’s compiling variants asynchronously. We’ll fix this, the error can be safely ignored and if it doesn’t appear in the player.
I’m having similar issues with my grass shader. I’ve tried disabling the asynchronous compilation of shaders; which makes the error go away while editing the scene.
However, when opening a Prefab to edit it; the log is spammed with 999+ of the same error as discussed, almost instantly. Might be something there as well? The grass renders perfectly fine; it just makes it somewhat unworkable as I have difficulty seeing actual errors.
EDIT: Forgot that you can just collapse the console to atleast have these errors bundled together. That’s workable enough for now I suppose! Hopefully a fix can be made soon. My Unity version is 2022.1.18f1
I’m just tired of all the unity’s bug, have a quick proof of concept to make this morning …
This is just killing productivity. @TerraUnity Did you find a “work around”
Regarding the perpetual issue I have with unity since like 3 / 4 years (after 10 years working on several project)
I’m considering to stop my subscription and find a another dev tools.
So no idea then when the fix will be released for Unity 2021? The version the bug was reported for? The LTS version that’s supposed to be stable? Because that information might actually be useful.
Disabling the asynchronous compilation of shaders in Graphics settings will stop these errors in the editor so you can try out before the official fix.