Calling GetComponent will get the text field assigned to the same game object as the script.
You need to get a reference to the object holding the text field.
Either make a variable that can be assigned in the editor
[SerializeField]
Text text2;
Or find the object at runtime.
↧