- Home /
,How do I connect a game object prefab to a TextMesh Pro text box?
What I am trying to accomplish is to have some text boxes in a side panel on the screen display information about the currently selected (or mouse overed) game object. In all of the solutions I have found so far, it involves setting up a text reference in a script which is attached to the game object, and then dragging the text box from the hierarchy panel to the slot for the reference on the Inspector view of the game object. Fair enough. That seems to work. However, I need this to be able to happen for an entire class of game objects, so I have tried doing the same thing with a prefab. I can't get this to work. The slot for the reference shows up, but the editor simply refuses to acknowledge the text box when I try to drag it in. I have even taken the prefab, dragged it into the scene, and dragged the text box onto that. Works fine. If I then take that object and drag it back to the prefab folder to create a prefab of that version of it, then the reference to the text box gets stripped out, and it won't let me drag it back in. Is there some other way of completing the reference within the script that is on the prefab that will support this? Or am I (Unity newbie) simply going about this the wrong way? BTW - I am using a Canvas with TextMeshPro text boxes.
Your answer
Follow this Question
Related Questions
How to get a pop-up window floating next to a gameobject? 1 Answer
List out all Array Values. 1 Answer
Setting the m_PrefabInternal property using the SeriailizedProperty System 0 Answers
TextMesh update causing framerate drop 1 Answer
Is it possible to request a line break inside the Inspector? 6 Answers