#LineRenderer sorting layer
1 messages ยท Page 1 of 1 (latest)
so, i tried the sorting layer that comes with the linerenderer but that has no effect
could you hint me on what to do?
no, you can just use transform.SetAsFirstSibling() to move to the bottom of the sibling list or use transform.SetAsLastSibling() (just make sure both of them are set as children of the same object or have a common parent if not then just change the parent of object)
this is my current structure
"resizer" holds all the mehses/text
should i set resizer as SetFirstSibling?
no
using transform.SetAsFirstSibling() takes it to the top thus it is rendered first thus it shows at the bottom
ok, but to which transform do i apply this
the linerenderers ?
Sol_10 is the first instantiated object, comes with Resizer
then i instantiate all the LineRenderers, and parent them to Sol_10
a better example of what i do right now
should i add a script to my linerenderer object and call first sibling there?
would recommend using transform.SetAsLastSibling() on resizer to put it below all of the line renderers and then callling this againg when yu create a new instance
cool, i will test this!
thank you ๐
no problem
and if you need help with code you can either make an event that the resizer script is subscribed to or put this code in the update method (not recommended)
i've tried different combo's but nothing seems to work
according to chat gpt it requires a custom shader?
oh ๐ฆ
my bad, no this is 3D
oh then you would need a shader
doh ๐
would you know what i should be looking for?
does this have a specific name?
no this is quite specific so there is no premade shader with a name
what about 3D canvas elements
does they have an option to always render on top?
yes since UI canvas elements are 2D they do work like that
now i dont know if this applies to linerenderers
but like with the game battlefield
that 330 M text, would always be on top
so the linerenderers would just be in 3D space
then i want 3D canvas to be the overlay on that
the 330 m is ui not an element
hmm
Simply put the Line Renderer on a different layer and render with another camera and stack them together
The other camera will only render the line renderer layer
Make sure you remove the layer from the previous camera
It is indeed an World Space UI
You can simply switch to a World Space UI under the Canvas
oh thats interesting
Could you tell me which render pipeline you are using?
URP
As camera stacking is different for different render pipelines
Then you can follow this to get started with Camera stacking
https://docs.unity3d.com/Packages/[email protected]/manual/camera-stacking.html
nice ๐
i will try that !
Just make sure you have the depth set to different values so it actually renders them one after the other
i will give that a go!
Basically cams with a smaller depth will be rendered before cameras with higher depth.
๐ฅณ
@bright isle to make text appear as well, does the text(TMP) need to be in a canvas?
yeah inside the canvas which is global space
Or you can also use the TextMesh component on an empty object to do it without a canvas
well any object does not need to be an empty one just saying ๐
Um like what's the problem?
Do you mean it's rotated?
Well yeah you would need to change it's rotation accordingly to make it point towards the camera
You can use the look at method as well
no i mean, if i face front the text dissapears
its for some reason not accepting the Layer
hm That's weird
Anyways you would need to rotate it to point it towards the camera anyways
or it will be flipped 
rotating doesnt seem to work
its like the text is not responding to the camera layer
almost there... all i need to figure out now how to not have the text on top of everything ๐
Make layers for different things and change their camera's depth accordingly