How to make part of my plane transparent with c#
I am making a rts game and I created a quarry in blender. My issue is that the building has a ramp leading down. The grass texture from my terrain blocks the entrance down. Is there any possible way to make the terrain under the model invisible once the object is placed, then make it visible again if the object is destroyed. I am making my terrain with a plane created in blender not the actual terrain editor in unity.
Answer by Foub · Jan 10, 2016 at 07:16 AM
So after a lot of researching I finally found the answer to my question. I used depth mask which was tricky to find because the only guide I could find is from 2013 and part of the coding is obsolete with the new unity 5. http://wiki.unity3d.com/index.php/DepthMask. So what I did was I created a child object (plane) in my quarry model that sat right above the model. I added the custom shader to my plane child object that is created in the shader script in the guide. After that you just copy and paste the SetRenderQueue.cs and place the script on the terrain (or w.e you want to make invisible). If you are using unity 5 you will have to change this, Material[] materials = renderer.materials; to this Material[] materials = GetComponent().materials;. Change the render queue on the terrain object in the unity inspector pannel to 2980 and bam it works.
Your answer
![](https://koobas.hobune.stream/wayback/20220612055334im_/https://answers.unity.com/themes/thub/images/avi.jpg)