Skip to main content
flarb
Up and Coming
March 24, 2025
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?

Shards632
Shards632Answer
Honored Contributor
March 24, 2025

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");`

June Programming Calendar

4 replies

Shards632
Shards632Answer
Honored Contributor
March 24, 2025

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");`

June Programming Calendar
flarb
flarbAuthor
Up and Coming
March 24, 2025

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

@flarb
PigeonNo12
Honored Contributor
March 24, 2025

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

Upcoming Events : Build with a Mentor: Custom UI Thursday 3/20 at 5:00 PM PT Register March calendar of all Mentor Workshops and Office Hours
flarb
flarbAuthor
Up and Coming
March 24, 2025

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!

@flarb