Convert a ulong to a string

Hi,
I am making an online multiplayer game and I am trying to assign each player a number and put it onto a TextMeshPro (username). I heard I can use OwnerClientId which spits out a consecutive digit for each player, but I get this error: “Cannot implicitly convert type ‘ulong’ to ‘string’” So I’m assuming OwnerClientID outputs a ulong and I need it to be a string. any way to convert it?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Unity.Netcode;
using TMPro;
using System;

public class usernameManager : NetworkBehaviour
{
   
    
    [SerializeField] TextMeshProUGUI Username;


    void Start()
    {
        if (!IsOwner) return;
        Username.text = OwnerClientId;
        Debug.Log(OwnerClientId + "; USERNAME: " + Username.text);
    }
   
}

The .ToString() extension will work on any C# object to turn it into a string.

If you want formatting, .ToString() takes extra arguments that may prove useful.

Yep, C# doesn’t have a cast for that. You could use ToString() if you just need a string with nothing extra done.

My go-to is string interpolation!

int x = 3;
float gimmeTwoDecimals = 12.345678ff;
ulong big = 10000;

string result = $"Stuff: {x} {gimmeTwoDecimals:N2} {big}";

The result: Stuff: 3 12.35 10000. The :N2 format specifier cuts that number down to two decimal places.

You can read more about format specifiers here.