[Solved] TMPRO not working as expected

Okay, so i want to make a UI that you can put the name of your buisness (using Input Field legacy) and then the name that you enter it will show to the van, and inside the van gameobject i inserted a Textmeshpro. So my issue is that i made a script that when you enter the name of your buisness it would show on the van but its not working. I think the issue is that legacy and textmeshpro arent compatible or something the error number line is 17. Here is the code:

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

public class InputField : MonoBehaviour
    public string theName;
    public GameObject inputField;
    public TextMeshProUGUI textDisplay;

    public void StoreName()
        theName = inputField.GetComponent<Text>().text;
        textDisplay.GetComponent<TMPro.TextMeshProUGUI>().text = ""+theName;

Can someone tell me what is going on? Thanks (sorry for my bad english)

Try TextMeshProGUI.SetText(string):


[quote=“VRStudy”, post:2, topic: 887761]
Try TextMeshProGUI.SetText(string):

it works! thanks!

1 Like