Sorting Layer with Immediate Mode

Avatar
  • updated
  • Answered

I'm using the Immediate Mode to create Polylines, but I want to control the Sorting Layer of the Line because I need to use it around Sprites. I know you can make the Polylines render before or after the Transparent objects, but what if I want a mix of both? By looking on the forum, I see that you can't use Sorting Layers on Immediate Mode, but I need the Polylines to Update the draw almost every frame as I'm planning to animate them. Is there any way or workaround?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér
  • Answered

sorting layers are used exclusively by Unity's mesh renderers, which immediate mode doesn't use. you'll have to use a component polyline for this, that you edit from code

Avatar
Billy G

I'm new to the Shapes world but running into the same problem, currently all my Shapes (example: Disc) are rendering below all of the Sprite Renderers in my scene.

I understand your statement above is that I won't be able to change the rendering order via sorting layers directly.  However, you state that it can be done via code.  Do you have a pointer to an example that I can review?  Any links would be appreciated.

Edit: My project is in Unity2D, hoping that shapes will be easy to integrate with all of my prior SpriteRenderer work.

Avatar
Billy G

Answering my own question here: I had set the Blend Mode to Opaque, the fix for me was setting the Blend Mode to Transparent.  Now my Sorting Layers are all working.