#LineRenderer sorting layer

1 messages ยท Page 1 of 1 (latest)

inland reef
#

yes you can

ocean solstice
#

so, i tried the sorting layer that comes with the linerenderer but that has no effect

could you hint me on what to do?

inland reef
#

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)

ocean solstice
#

this is my current structure
"resizer" holds all the mehses/text
should i set resizer as SetFirstSibling?

inland reef
#

no

#

using transform.SetAsFirstSibling() takes it to the top thus it is rendered first thus it shows at the bottom

ocean solstice
#

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?

inland reef
#

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

ocean solstice
#

cool, i will test this!
thank you ๐Ÿ™‚

inland reef
#

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)

ocean solstice
#

i've tried different combo's but nothing seems to work

according to chat gpt it requires a custom shader?

inland reef
#

you are working on 2D right?

#

this only works in 2D

ocean solstice
#

oh ๐Ÿ˜ฆ
my bad, no this is 3D

inland reef
#

oh then you would need a shader

ocean solstice
#

doh ๐Ÿ™‚

#

would you know what i should be looking for?
does this have a specific name?

inland reef
#

no this is quite specific so there is no premade shader with a name

ocean solstice
#

what about 3D canvas elements
does they have an option to always render on top?

inland reef
#

yes since UI canvas elements are 2D they do work like that

ocean solstice
#

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

inland reef
#

the 330 m is ui not an element

ocean solstice
#

hmm

bright isle
bright isle
#

You can simply switch to a World Space UI under the Canvas

ocean solstice
#

oh thats interesting

bright isle
ocean solstice
#

URP

bright isle
#

As camera stacking is different for different render pipelines

bright isle
ocean solstice
#

nice ๐Ÿ˜„
i will try that !

bright isle
#

Just make sure you have the depth set to different values so it actually renders them one after the other

ocean solstice
#

i will give that a go!

bright isle
#

Basically cams with a smaller depth will be rendered before cameras with higher depth.

ocean solstice
#

right!

#

i will post the results if any ๐Ÿ˜„

#

thank you @bright isle @inland reef

ocean solstice
#

๐Ÿฅณ

#

@bright isle to make text appear as well, does the text(TMP) need to be in a canvas?

bright isle
#

Or you can also use the TextMesh component on an empty object to do it without a canvas

ocean solstice
#

i am doing the second one, but its not rendering properly

bright isle
bright isle
ocean solstice
#

i have no idea, it looks like its angle dependant

bright isle
#

You can use the look at method as well

ocean solstice
#

no i mean, if i face front the text dissapears

#

its for some reason not accepting the Layer

bright isle
#

or it will be flipped var

ocean solstice
#

rotating doesnt seem to work
its like the text is not responding to the camera layer

ocean solstice
#

almost there... all i need to figure out now how to not have the text on top of everything ๐Ÿ˜„

bright isle