Hey guys, I was making an asssignment ( drawing game ) with Trail Renderers. I have a single script to generate it wherever the user touches the screen ( all this works well ), but I have a script that changes it’s color ( Material - Sprite/Default) to either of 4 colors using butttons. However when I draw it, I get it like this example Actually in this, I drew the red line in the last but it’s at the bottom. Is there a way I can make the Trail Renderer draw over the former one no matter what the color is ? I mean how do I overlap it ? Thanks .
A linerenderer makes use of one or more materials. It uses a certain queue, most likely 3000 for transparency in your case. I guess you’re using the same material despite the color change, which means its 3000 for all of them, and therefore in arbitrary order to be rendered. You can adjust the queue by changing the materials renderqueue to accending values (3001, 3002…)
Uhm at what “depth” do you draw your lines? Do you really use a TrailRenderer or a LineRenderer? TrailRenderers do disappear automatically.
If you use LineRenderers you can use localspace coordinates instead and then you can place the line renderers in the z position you like in case you want to reorder them. However simply moving each new line slightly closer to the camera will make it draw on top of all others.
If you want to use worldspace coordinates (which is the default) you would need to specify the depth directly in all the positions you generate.