Setting up a TextMeshPro field for the Owner

Hello, so i started a world project but i’m a 3D artist. I’m trying to learn anything about Udon# (using Udon Graph don’t bully me).
And i need for my world to have a TextMeshPro field which gets updated with the name of the Owner, so of the person that joined first in the instance (which in case they leave, the next and so on).
Since i haven’t found treads or documentations about it i’ve been trying to make it on my own and i can’t get to figure it out, it seems more complex than making anything else i did so far.
Anyone down to dedicate a bit of their time to teach me?

Here are some bits and pieces that might be useful:

  • Try adding a TextMeshProUGUI component and referring it in your Udon Graph script.
  • Use Networking.GetOwner() to get the owner of a gameObject.
  • You’ll want to update the text in the OnOwnershipTransferred event (and maybe in Start)

Hope this helps! :partying_face:

Is there any existing graph that you know of that i could see to study?
Cause i know what each of those components does, i checked the documentation an hour ago.
But my challenge right now is understand how to connect them in the graph and create a functional script out of it ^^

Create a U# script
To all - using

using TMPro;

public class - (the name of your script), add this code there.

	public TextMeshPro textElement;
	private string localName;
	private void Start()
	{
		localName = Networking.LocalPlayer.displayName;
		_SetNames();
	}
	
	public void _SetNames()
	{
		textElement.text = localName;
	}

Create an object on the scene - Text - TextMeshPro
Add Udon Behavior to it - move your script there!

You can try
localName = Networking.GetOwner(gameObject).displayName;