Okay, so, I'm very new, don't know how anything works, it might be stupid but I can't find any leads. I can't seem to be able to put a C# code into a text box. I've been following some simple tutorials, and we're just supposed to drag and drop the text in a box we created in the script thing, but it just doesn't work.
![200103-image-2022-09-23-142047148.png|587x420](upload://zgz9UX3j7bOGFTJvJH5dhHwLCgY.png)You are trying to assign a TextMeshPro component to a object that is of type Text.
This is confusing for new users but TextMeshPro is not the same Unity’s built-in Text. On line 4 of your code you have using UnityEngine.UI; This is the namespace that Text is in. However, TextMeshPro is it’s own package that you had to import in order to use, so it isn’t in that namespace.
Here’s how you fix it:
// Import TextMeshPro namespace
using TMPro;
// Change the variable type that you are trying to assign to
public TextMeshProUGUI text;
Now drag the TextMeshPro object into the variable in the inspector and you should be good to go.
Look at the images I have attached to see the difference between the 3 types of UI text in Unity.
Text
TextMeshProUGUI
There is also a third just called TextMeshPro but the forums only allow me to attach two pictures. This type of Text is created by going to 3D Object > Text-TextMeshPro.