Author Topic: textmesh pro text UGUI object sort in hierarchy  (Read 10489 times)

luniac

  • Newbie
  • *
  • Posts: 37
textmesh pro text UGUI object sort in hierarchy
« on: February 23, 2015, 10:29:28 PM »
The unity UGUI sorting works using the hierarchy with the objects at the top rendering under object as the list goes down.
I noticed however that the textmesh pro text doesn't obey this rule. I have an image lower in the hierarchy in my canvas but any textmesh pro text underneath the image but ABOVE it in the hieararchy still renders above the image.

Is this simply a limitation of the textmesh pro text UGUI object, and if so what's the easiest way to specify it's sort within the UGUI hierarchy?

Thanks :)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #1 on: February 23, 2015, 11:16:16 PM »
The unity UGUI sorting works using the hierarchy with the objects at the top rendering under object as the list goes down.
I noticed however that the textmesh pro text doesn't obey this rule. I have an image lower in the hierarchy in my canvas but any textmesh pro text underneath the image but ABOVE it in the hieararchy still renders above the image.

Is this simply a limitation of the textmesh pro text UGUI object, and if so what's the easiest way to specify it's sort within the UGUI hierarchy?

Thanks :)

I guess I never ran into this as you normally want the text in front of images.

Interestingly, in the game view the sorting is correct but not in the scene view. Can you confirm you are getting the same behavior on your end?

UPDATE - When the Canvas is in Screenspace overlay the sorting is correct in the gameview but in Screenspace Camera with a camera assigned it is wrong. I'll get in touch with Unity to figure out why this is wrong given Unity controls the sorting order when submitting UiVertices to the CanvasRenderer.
« Last Edit: February 23, 2015, 11:25:39 PM by Stephan B. »

luniac

  • Newbie
  • *
  • Posts: 37
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #2 on: February 24, 2015, 06:50:49 PM »
In my case i showed a "loading" image over the buttons with text, and the button texts were rendered above the loading image, which is how i found out this issue.

I use World Space canvas and the text renders above the image both in scene view and game view.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #3 on: February 24, 2015, 07:21:03 PM »
In my case i showed a "loading" image over the buttons with text, and the button texts were rendered above the loading image, which is how i found out this issue.

I use World Space canvas and the text renders above the image both in scene view and game view.

Since the geometry generated by TextMesh Pro is submitted to the CanvasRenderer, Unity takes care of the sorting. However, in this case it is not being done correctly and behaves differently based on Canvas modes. I am in contact with Unity to figure why this is not behaving as expected. Hopefully, I we can get this sorted out shortly.

luniac

  • Newbie
  • *
  • Posts: 37
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #4 on: March 06, 2015, 12:37:49 AM »
any news?  8)

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #5 on: March 06, 2015, 12:08:58 PM »
any news?  8)

I spoke with Philip Cosgrave from Unity at GDC and provided him with a Repro of this issue. He will be at Pax East this weekend but should be looking into it when he gets back early next week.

I will follow up with him as well.
« Last Edit: March 06, 2015, 07:40:07 PM by Stephan B. »

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #6 on: March 13, 2015, 05:28:00 PM »
any news?  8)

I spoke with Philip Cosgrave from Unity at GDC and provided him with a Repro of this issue. He will be at Pax East this weekend but should be looking into it when he gets back early next week.

I will follow up with him as well.

Just did a bunch of new tests in Unity 5.0 and it all seems to be working fine. I am pretty sure it was misbehaving a few days ago but that must have been in Unity 4.6.

<a href="https://www.youtube.com/v/jMCL6zMj1SQ" target="_blank" class="new_win">https://www.youtube.com/v/jMCL6zMj1SQ</a>

kjedi24

  • Newbie
  • *
  • Posts: 1
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #7 on: March 13, 2015, 08:03:50 PM »
Just did a bunch of new tests in Unity 5.0 and it all seems to be working fine. I am pretty sure it was misbehaving a few days ago but that must have been in Unity 4.6.

The issue seems to occur between Image objects and TextMeshProGUI objects when the Canvas is set to Screen Space - Camera. The text objects will layer with each other correctly but they are always on top of the sprite in both Scene view and Game view.

I tested with a simple project and confirmed it was an issue in both Unity 4.6.3p2 and 5.0.0f4.
« Last Edit: March 13, 2015, 08:05:45 PM by kjedi24 »

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #8 on: March 14, 2015, 12:24:02 AM »
Just did a bunch of new tests in Unity 5.0 and it all seems to be working fine. I am pretty sure it was misbehaving a few days ago but that must have been in Unity 4.6.

The issue seems to occur between Image objects and TextMeshProGUI objects when the Canvas is set to Screen Space - Camera. The text objects will layer with each other correctly but they are always on top of the sprite in both Scene view and Game view.

I tested with a simple project and confirmed it was an issue in both Unity 4.6.3p2 and 5.0.0f4.

I just tested with an image sprite in Unity 5.0 with the Canvas set to Screen Space - Camera with or without a camera assigned and it is working correctly. Take a look at the following video.

I do not doubt your report. So I am trying to figure out what makes it behaves differently. Although I am using a different version, I don't recall having made any changes that would affect this behavior. So clearly something is up.

<a href="https://www.youtube.com/v/mnyb5FCIrYk" target="_blank" class="new_win">https://www.youtube.com/v/mnyb5FCIrYk</a>

UPDATE - Found it. Some of the default font assets are using the wrong render queue and the ones I was testing with had it set correctly. Now looking into when / how those were changed. If you set the inspector in Debug Mode and look at the materials, those with Render Queue set to -1 will work fine those set to 3001 won't.

Looks like only the default ARIAL SDF was set to 3001 instead of -1.

P.S. Verified in Unity 4.6 and Unity 5.0. With the Inspector set to Debug mode, you can select the ARIAL Font Asset. Then select the embedded material and change the Custom Render Queue to -1.
« Last Edit: March 14, 2015, 12:50:15 AM by Stephan B. »

MochiBits

  • Newbie
  • *
  • Posts: 1
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #9 on: April 02, 2015, 04:58:38 PM »
I'm still seeing this with 3d objects even with the Custom Render Queue set to -1. I'm on 4.6.3f1.

I did notice however that 2d sprites (non-ui images) do render over the top of the TMP UI objects properly.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5631
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #10 on: April 02, 2015, 05:04:33 PM »
I'm still seeing this with 3d objects even with the Custom Render Queue set to -1. I'm on 4.6.3f1.

I did notice however that 2d sprites (non-ui images) do render over the top of the TMP UI objects properly.

Which version of TextMesh Pro are you using?

Can you create a simple scene / Repro package for me to look at or post a few images showing the scene hierarchy, the text object inspector where I can see the properties as well as the material inspector? It is hard to pin point what might be happening without a better understanding of the scene.

 

kreso

  • Newbie
  • *
  • Posts: 8
Re: textmesh pro text UGUI object sort in hierarchy
« Reply #11 on: November 03, 2018, 11:58:46 PM »
This is an old topic, but pertinent to my problem.

Using Unity 2018.2.0f2
TextMeshPro 1.2.4

Canvas is set to 'Screen Space - Camera'.

The font is not visible in Game View. It is visible in SceneView only if '2D' viewing mode is ticked.
Tried setting Render Queue, no changes.
Shader set to TextMeshPro/Mobile/Distance field

Setting shader to TextMeshPro/Distance Field (Surface) shows black square (in game view & scene view).
Setting shader to Bitmap (mobile or not) shows properly (game view & scene view).

Any ideas are welcome :-)

Kind regards,
Kreso