Hey, I’ve just run across a pretty weird issue here. Basically what’s happening, is I have a script that allows me to click anywhere in the world, and have an orthographic camera look at the spot I clicked. It also checks if the object I clicked has a script attached to it. This script will add a second material to the objects renderer. It will add the script if it doesn’t already exist. The material I’m adding in this case is just a simple diffuse material with no texture or anything. The problem comes when clicking in certain areas of the world. It seems that if the camera views some of my meshes at a certain angle, it wont render the mesh at all. This only happens at certain angles. When I do either of the following, the mesh renders fine from any angle.
A: Simply remove the code that adds the second material
B: Add the second material to every object immediately in the Awake handler rather than as needed when I click on a mesh
I realize this sounds like a pretty obscure issue, but I’m basically trying to create a system allowing me to paint a texture onto any mesh in my game, and would like to avoid having to add this second material to all of my objects in the world at once.
I have attached a sample of the problem. Does this seem like a Unity bug to anyone? In the sample, you can reproduce the issue by hitting play, and clicking in the bottom left corner of the vertical wall on the left side of the screen.
1218731–50039–$UnityDoubleMaterialRenderingProblem.zip (158 KB)