Strange Issue with Dynamic Mesh and Receive Shadows

I have attached a small Unity project. I’m using the free version of Unity on a Mac, and just getting started. The project shows three spinning cubes called TileCenter, TileLeft, and TileRight. The meshes for the cubes themselves are created dynamically.

Now here’s the strange part, and you can try this in the scene editor, but to see the result you’ll need to be in play mode. If you click the three tiles, you’ll see in the inspector that exactly one of them, TileRight, has its “Receive Shadows” flag turned on. Now, my understanding is that in Unity’s free mode, there are no dynamic shadows, so these flags should have no effect. But not only does this flag have an effect, if you turn off TileRight’s “Receive Shadows” flag and enter play mode (or just do it from within play mode) all three cubes disappear. Furthermore, turning on either of TileLeft or TileCenter’s Receive Shadows flags again causes all three cubes to disappear. Try playing with the Receive Shadows flag of the other cubes and you’ll see that only combination that seems to not hide some or all of the cubes is the one we started with.

What gives? It seems like these flags shouldn’t matter at all. Is this a bug?

472998–16628–$TestProject.zip (287 KB)

I’m having the same problem. I created 4 plane meshes procedurally and turned off cast recieve shadows. However, the meshes will not render unless every other mesh has recieve shadow checked. Does anyone have any thoughts as to what might be causing this?

For whatever reason, calling mesh.Optimize() fixed my problem.

Did you try calling mesh.RecalculateNormals()?

After you update a mesh’s vertices, you should call that method. It’s essentially similar to applying a “smooth” modifier in 3ds Max. It will redo your normals so the model looks right.

In 3Ds Max, the smoothing thing is just for getting rid of unwanted hard edges… but in Unity, if you don’t call RecalculateNormals after a mesh update, you might get a mesh that doesn’t respond well to lighting at all.

Cheers