- Home /
Question by
nzmichael118 · Sep 14, 2017 at 07:37 PM ·
prefabtext
prefabs aren't letting me connect a text public thing to it
I can set one individually but it wont work setting it as a prefab.
I cant drag and drop it
capture.jpg
(37.5 kB)
Comment
Answer by Raimi · Sep 14, 2017 at 09:38 PM
Your prefab cant connect because it is not active in the scene so TextObject dosen't actually exist for the prefab.
On your prefab you need to do...
void Start()
{
CountText = GameObject.Find("CountTextObject");
//or
CountText = GameObject.FindWithTag("CountTextObject");
}
You need to reference your Text object in OnEnable, Awake or Start.
Hope this helps.