Search Unity

TMPro text disappears when parented to AR objects with canvas subobjects

Discussion in 'UGUI & TextMesh Pro' started by kingbaggot, May 23, 2020.

  1. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    I'm taking a screen space canvas ui object - with a UI image and some TMPro text, and when an AR object is created - i set it's parent to be that AR object's canvas object - ( I have to reduce the UI objects scale to 0.01 or the object is scaled x 100 on the AR object)

    The UI image appears just fine, but the text is gone (although traced out it is still in the same position as the UI image) .

    I thought there might be some issues parenting between a screen space and a world space canvas, but as the UI images appears fine, I wonder what I might need to do to the text to get it to transfer correctly.

    as a side-note, I can add that same UI image & TMPro text to the AR object directly in the editor and both display fine. It's just the process of parenting that is messing it up.

    I'm on 2019.3.1 and AR Foundation 2.1.

    any pointers mucho appreciated !
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using a mixture of <TextMeshPro> and <TextMeshProUGUI> objects where these share the same material?

    Although having a mixture of text objects in overlay and world space that share the same material, it is possible that when parenting such objects between the two, that you end up with the same issue as using a mixture of <TextMeshPro> and <TextMeshProUGUI> objects that share the same material.

    In the above cases, we end up with a fight over the ZTest settings as the requirements are different between spaces and as such a material cannot be all things all at once.

    See if using a different material preset on the object switching space makes the issue go away.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The scaling might be an issue as well. See if that affects it ... ie don't go to near zero for testing