Set UI Text string

Posting this here because it took me way too long to figure out:

I wanted to have some way of setting debug text in world, and it took me a while to realize I needed to use a UIText component.

It also looks like there is currently no way to reference a TextMesh or TextMeshPro component or am I missing something?


I don’t believe there’s a TMP interface yet, as the focus has been on getting vanilla Unity interfaces solid first. You definitely should post about it in the Feedback boards, though!

You can already find it on the feedback board

1 Like

UdonSharp code if anyone needs it:

using UnityEngine.UI;
textPanelGameObject.GetComponent().text = “Script loaded successfully”;

1 Like

If you in addition want to merge together several strings you can use “string addition” for 2 of them or “string Concat” for 2-4 of them.

1 Like