- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
Simon 9 · Mar 23, 2013 at 01:42 PM ·
layerslinerendererculling mask
Line Renderer not working at all with Layer and Culling Mask when created in script
I have a Line Renderer with the layer set to one I made called GUI.
I have two cameras, Main Camera and GUI Camera. One persp, one ortho. Main has its Culling Mask set to all except GUI. GUI has its culling mask set to GUI only.
I have an object called "Selection Box". It has a LineRenderer that I add in script. Its layer is set to GUI.
My LineRenderer is drawing on the Main Camera, and not drawing on the GUI Camera. This is backwards.
I got past this by creating the line renderer in the editor instead of in script. If I do that, it draws on the right layer.
Comment
I just got a similar problem. For what I'm seeing, the problem is the camera. If I disable the camera and re enable it, it work. Don't know what the problem, For now, i'll hack around it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094934im_/https://answers.unity.com/themes/thub/images/avi.jpg)