Hey guys, I’ve been trying to do something which should’ve been simple, but apparently I’m missing something.
So I was using, “if (renderer.materail.mainTexture == myTextureVar)” to see if a texture is being used, to do something. Which worked fine. But it brought my draw calls from 13 to 24. I’m still in alpha with this project, so I’m afraid if I “allow” that to be, things will get out of hand by the time I say it’s finished.
Anyways, so I figured out that changing the texture at runtime causes a new draw call, so I switched to the shader/material, and that kept my calls low.
But when I do “if (renderer.material == myMaterialVar)” then it doesn’t work.
I even debug the material used, and here’s where it gets weird. Instead of just debugging the “Material used is: myMaterialVar”, it writes, “Material used is: myMaterialVar (Instance) (UnityEngine.Material)”.
What do I have to script to check what material is being used if unity makes an instance of it and all other kinds of nonsense? And is there any documentation on this strange issue?
P.S. I write in javascipt