(Layers) I'm making a portal using URP's stencil, and can't use object's layer to make it in or out

I can make it works in Unity Editor, but once I attach this.gameObject.layers.set(7); it seems not work in the webpage.
Any know why?



Original Post on Discord

by user 917448042540576788

Is the planet a UI object or a normal mesh with a mesh renderer?

It’s a normal mesh

by user 917448042540576788

I tried this.layer but it’s a get not a set, so I don’t know if I can control layer in runtime

by user 917448042540576788

you can set the layer on the threejs object as usual (that’s this.gameObject when you’re on a component)

But in threejs the stencils are separate settings - I’d have to look into the specifics. Have you tried comparing it with our stencil sample?

Have you setup the stencils using URP RenderObject stencil settings?

I think I’m using the same way as the sample: setting in Render Object

by user 917448042540576788

But what I wanna do, is the girl entering into the door, and change the layer of Inner World objects, so can make the effect that She Enters Into the Portal World

by user 917448042540576788

using the onCollisionEnter and Exit

by user 917448042540576788

That’s cool. I mean a first step should be to figure out why its not working, so something must be different. If you could figure out whats the difference would be great so we can add a fix :slightly_smiling_face:

Ok let me check first, thanks for your quick reply

by user 917448042540576788

No problem

Having achieve the goal!
20221217_154527.mp4

by user 917448042540576788

Thats awesome!

What was the difference? What did you change to make the stencils work?

using a pretty trick: have two group with different stencil settings as two worlds, then use GameObject.SetActive to swith between two worlds


by user 917448042540576788

Changed the channel name: (Layers) I’m making a portal using URP’s stencil, and can’t use object’s layer to make it in or out.

by user 917448042540576788

by user 917448042540576788