Graphics.DrawMesh wont work with transparent shader.

Greetings I have some issue with the Graphics.DrawMesh function I use it to draw a selection grid.
The problem is I only can see it inside the editor window when using a transparent shader.


Left is editor view and right is the game view.

        Tags { "Qeue" = "Transparent"  "RenderType" = "Transparent" }
        LOD 100
        ZWrite OFF
        Blend SrcAlpha OneMinusSrcAlpha

With this settings its only visible inside the editor.

Using this settings works in editor and game view.

        Tags { "RenderType" = "Opaque" }
        LOD 100

The code i use when calling Graphics.DrawMesh

       Graphics.DrawMesh(topMesh, renderPosition, Quaternion.identity, materialClean, drawLayer);
                    if (IsInsideBounds(x, z + 1, currentMap.GetLength(0), currentMap.GetLength(1)) && currentMap[x, z + 1] != 0 || z + 1 == endZ)
                        Graphics.DrawMesh(frontMesh, renderPosition, Quaternion.identity, materialClean, drawLayer);
                    if (IsInsideBounds(x + 1, z, currentMap.GetLength(0), currentMap.GetLength(1)) && currentMap[x + 1, z] != 0 || x + 1 == endX)
                        Graphics.DrawMesh(rightMesh, renderPosition, Quaternion.identity, materialClean, drawLayer);
                    if (IsInsideBounds(x, z - 1, currentMap.GetLength(0), currentMap.GetLength(1)) && currentMap[x, z - 1] != 0 || z == startZ)
                        Graphics.DrawMesh(backMesh, renderPosition, Quaternion.identity, materialClean, drawLayer);
                    if (IsInsideBounds(x - 1, z, currentMap.GetLength(0), currentMap.GetLength(1)) && currentMap[x - 1, z] != 0 || x == startX)
                        Graphics.DrawMesh(leftMesh, renderPosition, Quaternion.identity, materialClean, drawLayer);
                    continue;

For render layers i tryed setting it to 0 and 1.

I don’t think this is the correct spelling of Queue … is that the problem?

1 Like

You are f…kn brilliant.

I spent more then 5 hours trying to figure out whats going wrong.

2 Likes

Glad to hear it. I just posted in another thread how I’m always making errors too… it’s annoying when you have an ad-hoc string tag like that where the compiler can’t help you and say “I don’t know what a Qeue is…”