← Back to all addons

Ingame Show Username

Posted by Mr.Titan on Sep 7, 2025 at 4:22 PM

Feature3.0 Verified
💡 2

It dependens were you want to put it, in this case i put it on top of the health bar.

Just open the HUD prefab, copy the text on the bottom to the top and assign the script in attachment, thats it.

In case you want some more complex stuff, in my case i’m listening for changes. You can listen to ranks, achievmeents, abilities, wtf and update on demand.

namespace Gyvr.Mythril2D
{
    public class UIPlayerNameText : MonoBehaviour
    {

        private TextMeshProUGUI textMesh = null;
        // Start is called once before the first execution of Update after the MonoBehaviour is created
        void Start()
        {
            textMesh = this.GetComponent<TextMeshProUGUI>();
            DisplayName(); // Show on start
            GameManager.Player.achievementsChanged.AddListener(DisplayName); //listening for changes
        }

        private void DisplayName(AchievementSheet[] arg0)=>DisplayName();

        private void DisplayName()
        {
            this.textMesh.text = GameManager.Player.PlayerTitle(); //i created this method to get either the username or the achievmenet
        }
    }
}

💬 Comments (5)

Zuko Sep 07, 2025 at 04:33 PM

Thank you very much @Mr.Titan ! awesome work!

just to clarify:

step 1 - Just open the HUD prefab, copy the text on the bottom to the top

step 2- create new monobehavior script, paste this code,, save and assign the script in attachment

👍 1
Zuko Sep 07, 2025 at 04:33 PM
thats it?
Mr.Titan Sep 07, 2025 at 08:19 PM
Thats it! Note that if you create a new monobheaviour you need to set the class in the code to have the same name has your file. Otherwise you can just copy and past the file i left on top (and if you want the last code you can just copy and past the code into that file, only the logic changes the class is the same)
👍 1
Mr.Titan Sep 07, 2025 at 08:30 PM
You may probably have to adjust other UI’s to fit properly, because as you can see in the video, the messages are on top of the mana bars, because those bars were dragged more to the bottom because of the text.
👍 1
Zuko Sep 07, 2025 at 08:47 PM
ok, thanks for the context and help!

Want to continue the conversation?