I tried doing this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Text : MonoBehaviour
{
public Spawn_stuff spawn_Stuff;
public Text display;
// Start is called before the first frame update
void Start()
{
display.text = "Hello world".text
}
// Update is called once per frame
void Update()
{
}
}
But Unity will not recognize the .text or public Text display; as being part of the UnityEngine.UI field. It thinks the syntax is incorrect.
Let's try to use TextMeshPro to display text in Unity. if you use Text from TextMeshPro in Unity Editor so in script you have to reference TextMeshProUGUI not Text.
here is new version of your script: