TextMeshDOTS icon indicating copy to clipboard operation
TextMeshDOTS copied to clipboard

Is there any way to change the sortingOrder?

Open renyunhao opened this issue 8 months ago • 1 comments

When place the text with sprite together,if we want to make sure the text render on top of sprite,we need to make sure the sprite's sorting order to negative number. It seems the text renders at sorting order 0. So is there any way to change the text's sorting order value?

renyunhao avatar Apr 15 '25 07:04 renyunhao

There are two things you can try...would be great if you can do that and let me know what works best.

  1. Change layer here https://github.com/Fribur/TextMeshDOTS/blob/72b5d7f8e0db46727d528fcc027b27bd3fc2f5f1/Authoring/TextRendererAuthoring.cs#L79
  2. Add AddComponent<DepthSorted_Tag(entity); here https://github.com/Fribur/TextMeshDOTS/blob/72b5d7f8e0db46727d528fcc027b27bd3fc2f5f1/Authoring/TextRendererAuthoring.cs#L166 (this will reduce performance by ~50%. So for e.g. 10,000 text labels, performance will go from 500 FPS to 200 FPS. But is technically the correct way to do it.

Fribur avatar Apr 15 '25 21:04 Fribur