Search Unity

TMP UI text disappearing in AR when re-parented to world-space canvas

Discussion in 'UGUI & TextMesh Pro' started by kingbaggot, Jul 7, 2020.

  1. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Hi, quick one that I can't fix myself.

    I have an Screenspace canvas object that I re-parent to a world-space canvas attached to an ARprefab.

    All the UI child images appear fine and at the correct scale, but the TMP assets have all become invisible (they trace out in the correct positions though)

    Any TMP assets already on the AR prefab are fine though.

    Has anyone else had this issue ?

    I'm on 2019.3.1 but I've had this issue with other versions of Unity too . Never found a fix, just fancied sorting it out this time around :)
     
  2. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    I've narrowed it down to .. Any TMPtext that gets re-parented to a canvas attached to an AR prefab displays fine, until you access it's recttransform - and then *POOF* it becomes invisible :O

    Would love a fix for this if anyone has it.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you please submit a bug report with the included project for me to take a look at?

    Not sure why accessing the RectTransform would go *POOF*. When it does that, are the values of the RectTransform changes somehow? Maybe Anchor or Z?
     
  4. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    thanks for the response Stephan,

    I've built another font asset and integrated that and it *DOES* display (yay) - but only as white rects (boo)

    I've looked up the forum posts on this and checked to see if the local scale is uniform (it is) and tried calling ForceMeshUpdate() on the text but it doesn't fix it.

    I've looked up your responses here - https://forum.unity.com/threads/the...-getpreferredvalues-and-word-wrapping.783473/ - and will try some of the approached mentioned here and see how they go.

    Is there any more obvious method I should be using ?

    thanks,
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If you are able to reliably reproduce this behavior, please submit a bug report with project and steps to reproduce. This will make it easier for me to figure out what is going on and resolve the issue for you.

    White Blocks are indicative of the SDF scale being which happens when the scale of the text object might be zero at some point.

    Seems like whatever is going on when you parent the object, results in the scale of the text object being zero at some point.
     
  6. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    ok. bug and enormous project sent !
    I also tried upgrading TMP to 2.1 and also trying some variations on the shaders but still no dice.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you.

    Please provide me with the Case # once you have it. This will make it easier for me to find the bug report.
     
  8. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Hi Stephan - it's Case 1263129
    It's a bit of a pain to re-create because it's using AR Foundation - sorry.
     
  9. kingbaggot

    kingbaggot

    Joined:
    Jun 6, 2013
    Posts:
    51
    Hi Stephan again - my PC locked up which that project was getting uploaded and it's submitted the bug twice ! - so it's both Case 1263043 AND 1263129 - arrgh.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I am circling back thru bug reports and looking at your case. First, are you still having the issue?

    If you are, in the latest version of the TMP package, which is version 2.1.1 for Unity 2019.x, the TMP Essential Resources have been updated to include new shaders with the suffix SSD as seen in the image below.

    upload_2020-9-1_17-8-11.png

    These new shaders handle SDFScale differently and as such, if your issue was SDF Scale related, using the mobile SSD version would resolve your issue. Let me know if using this new shader resolves the issue.

    I am still looking into the original issue to figure out why the SDF Scale is incorrect (potentially) but need to get an Android device that support ARCore as mine does not support it.