Forum Discussion

flarb's avatar
flarb
Partner
9 months ago
Solved

TextGizmo text.set not updating text at runtime

Is there some trick to changing the content of a TextGizmo at runtime? I call text.set with a string and it doesn't update. If I print the contents after set with text.get it returns "..." which isn't the default contents that are on the textgizmo in scene. How do you update these?

  • There is no 'trick'.  You should just be able to call text.set('value'). Make sure you are working with a TextGizmo, tho... e.g.
    `this.props.gizmo?.as(TextGizmo).text.set("hello");`

4 Replies

  • There is no 'trick'.  You should just be able to call text.set('value'). Make sure you are working with a TextGizmo, tho... e.g.
    `this.props.gizmo?.as(TextGizmo).text.set("hello");`

    • flarb's avatar
      flarb
      Partner

      Yeah that's essentially what I'm doing and the text never updates. I don't get any errors or anything.

      • PigeonNo12's avatar
        PigeonNo12
        Partner

        Can you share the code that you are using please? This way we can try to replicate using your exact scenario.

  • Actually, I was about to post the snippet when I realized my TextGizmo reference was bad. I'm not sure why it didn't throw an exception, but now that I've properly cast the property to TextGizmo it works! Thanks for the help!