- Home /
How can I make grid tiles/plane transparent
Hello guys. I have made a grid using multiple planes. Now I want to place a image on this grid so that user cant see the grid I have made and I ll have access of all points of the image using grid.
The problem is I am unable to place image on it, it shows me grid that I made before. I have tried Materials/Shader -> Transparent/Diffuse, but some blocks are still visible. How can I make grid tiles transparent ?
Answer by Owen-Reynolds · Sep 30, 2011 at 03:24 PM
Setting Transparent->Diffuse tells Unity that if the texture happens to have some transparent parts, actually make them transparent, instead of just white. So, it will work if your texture happens to be completely transparent.
Probably set MainColor's alpha to 0, in the material, using the Inspector. That will make any texture completely transparent. If you want a square to turn faint blue when it's selected, use a small white texture and play with MainColor in code (faint blue = (0, 0, 1, 0.25), etc... .) I'm assuming you have the big picture "behind" the see-through boxes.
If you never want to see the squares, remove the MeshRenderer. The collider will still be there, for raycasts or whatnot, it will simply skip the entire draw step.
Default Unity planes use a mesh collider, which in theory is slower. Their plane has 200 tris, but it might use some shortcuts. Very short cubes do the same job as planes and might run a little faster (they use box colliders.)
Thanks owen, I ll try it on my very next working day and let you know. One more question I want to ask, I am making a tower defense game and a grid is needed, so that I can access every point of it. What basically I am trying to implement is:
$$anonymous$$aking multiple planes in form of 2D array and placing my actual image($$anonymous$$ap) on it, in this way I am accessing the specific point for game operations. so my approach is right ? I ll appreciate your help.
You may be able to use (for example) a 40x40 array in your code, without having to actually create and place 40x40 gameObjects.
For example, ins$$anonymous$$d of a mouse-rayCast to check the box you hit and read the grid coords from it; ins$$anonymous$$d you can mouse-RayCast to the ground and use the world x/z where you hit to compute the grid coords.
To check if someone can place a tower there, can check $$anonymous$$ap[x][z]==0
without having to do any rayCasting.
Even if you want to "light up" the space they pick, you can move a single box around. If you want to light up all the spaces they can move to, say, then you probably need to create all those transparent gameObjects.
Your answer
![](https://koobas.hobune.stream/wayback/20220612231900im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Plane - 10x10 grid - Questions about it. 1 Answer
A node in a childnode? 1 Answer
What is grid in unity and how can I implement it ? 1 Answer
C# Plane Detecting a Gameobject 1 Answer
C# Plane Collision Detection 1 Answer