Search Unity

.text not updating on Android Phone

Discussion in 'UGUI & TextMesh Pro' started by millefoliumink, Mar 27, 2019.

  1. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    I'm having a strange issue, I'm dynamically changing a TextMeshProUGUI .text to generate a question and then saving that .text for later purposes to string, everything is working fine in the editor.

    When I build the app to Android although the TextMeshProUGUI changes visually (I can see a new question in the text box), when I try to retrieve the .text and store it to string it only returns the default property that is set in the editor prior to play (some "Lorem Ipsum").

    It's like it's returning a cached version of the .text and not the current version.

    Unity 2018.3.0f2
     
    Last edited: Mar 27, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you initially setting the text using the SetText() function?

    If you are using the .SetText() function to set the text, the .text property is kept in sync in the editor but not at runtime since setting the .text property would result in allocations.
     
    millefoliumink likes this.
  3. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    I wasn't, this indeed was the issue, thank you!