Search Unity

TextMesh Pro: SetText not updating/saving in Editor

Discussion in 'UGUI & TextMesh Pro' started by spsmith224, Apr 2, 2020.

  1. spsmith224

    spsmith224

    Joined:
    Oct 25, 2016
    Posts:
    5
    Running into a weird bug today when trying to set text via script. I have a script that sets the text on a bunch of child objects with TextMeshProUGUI components. The parent object and child objects are prefab instances. There is a button in my custom inspector that sets the text.

    My problem is, when pressing this button, the text is not updating correctly. Visually, the text does not update at all. If I select the actual TextMeshProUGUI component, then all the text suddenly updates. I can also force it to update by setting the GameObjects inactive and then active again. However, these updates aren't saved, and are lost when reloading the scene. If I call the same method the button uses through a ContextMenu attribute, the text does update visually, but still isn't saved. Using the SetText method or using the text property doesn't make a difference.

    I duplicated the object I was testing on and unpacked it from its prefabs. On the unpacked object, the button works exactly the same: no visual update and no saving. However, running the method from the ContextMenu works correctly, updating the text immediately and saving it with the scene.

    I'm mystified why things would behave this way. Any ideas? This is on Unity 2019.3.7f1 and TextMeshPro 2.0.1. Thanks.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please test with version 2.1.0-preview.8. If the problem persists, please provide me with a reproduction case / project so I can take a look at why this is happening.