If you want to render things in front of UI then you can't achieve this with "Screen space overly" here is the reason.
So we are having two choices to chose from:
- World space.
- Screen space - Camera.
For more information about canvas and canvas render more please visit here.
To achieve such a effect with world space its too easy to do, You just have to change sorting order or Sorting layer of the object to render it front or at back of the UI.
Now when we have to render Line Rendrer or Trail Rendrer in front of the UI, Then i have to change sorting order to some thing bigger then canvas sorting order, Let suppose canves sorting order is 0 then i have to change Line or Trail rendrer sorting order to some thing like 1 or anything bigger then 0.
Trail Rendrer Settings:
Or we can achieve this using Sorting layer.
In order to use sorting layer then you have to create multiple layers. By default there is only one layer called "Default".
To create more layer you can click on Sorting layer - Default and then Add Sorting Layer.... And then just add the layers you want...
Now unity will render sorting layer "Default" first then on top it Sorting layer "UI" will be rendered and the at last Sorting layer - Trail will be rendered.
For "Screen space - Camera" same mathod will be applied like in World
I hope this will resolve the quires you have about sorting layer and sorting order and canvas render mode etc.