#make the discord clickable with the logo next to it so it stands out for feedback

1 messages · Page 1 of 1 (latest)

weary geyser
#

usage example

#

but yea you can CSS the text .. i need to pull my project if you need more info, but cool idea to open the url that way

#
using UnityEngine;

public class HyperlinkOpener : MonoBehaviour
{
    private TMP_Text textMeshPro;

    void Awake()
    {
        textMeshPro = GetComponent<TMP_Text>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            int linkIndex = TMP_TextUtilities.FindIntersectingLink(textMeshPro, Input.mousePosition, null);
            if (linkIndex != -1)
            {
                // Get the link ID
                TMP_LinkInfo linkInfo = textMeshPro.textInfo.linkInfo[linkIndex];
                string id = linkInfo.GetLinkID();

                // Check the link ID and act
                if (id == "ID_01")
                {
                    SocialRoll.Instance.JoinDiscord();
                }
            }
        }
    }

}
#

thats how i did it haha

#

i just realized i gotta change to the proper input system for controllers woopsie