#Cant drag text into my Score text script

1 messages · Page 1 of 1 (latest)

delicate harbor
#

hi im currently watching Brackeys ''how to make a video game'' part 7 and at the time stamp of 7:40, he drags the text into his score script. It wont let me put the text into the score script. it becomes like a red circle. pls help

untold kraken
delicate harbor
#

i dont get it where does it say ''using TMPro?

delicate harbor
mellow field
#

It sounds like you are trying to drag a Unity UI Text component into a variable in a script, but it's not working as expected. The reason for the red circle is that the variable in the script is likely not of the correct type to accept a Unity UI Text component.

You can check the variable type in the script and make sure it is of the correct type to accept a Unity UI Text component. If it's not, you can change the variable type in the script to match the type of the Unity UI Text component.

Another possibility is that the script is not on the same GameObject as the Unity UI Text component, you need to make sure that the script component is on the same GameObject as the Text component, or you can use GetComponent<>() function to get the text component.

Finally, you can try to reimport your Unity UI package if the problem persists, as it may be a problem with the import.

Please let me know if you have any other question or if this solution did not work for you.
-ChatGPT

delicate harbor
#

how do i match the vaiable type? is it suppose to be the exakt same name as what is says outsite the script? its called TextMeshPro - Text (UI). am i suppose to write that in the script? right now i have written ''public Text scoreText;''

mellow siren
#

No, Text is the class for the normal Unity UI text (UnityEngine.UI.Text), which is not interchangeable with the TextMeshPro type. What you need to use is TextMeshProUGUI (make sure to include the TMPro namespace in order to access this type or any type related to Text Mesh Pro).

delicate harbor
#

where and how do i include the TMPro?