- Home /
Cant drag InputField to property of script in Inspector
I am pretty new to Unity, so please forgive me if its a basic question (i am sure it is, in fact..)
I have some InputFields, an empty GameObject that has a script attached to it, which handles the behaviour of the scene (there are buttons, and so on). I have some fields in the script (public InputField if1, if2, etc.).
My plan is to drag the InputFields to the properties in the inspector so I can access them in code when certain buttons are pressed...but I cant drag and drop them. I see a black circle when I have the InputField (dragged from the hierarchy) over the field of the script, in the inspector.
Is this the proper way of doing it? How can I drag my InputFields to the proper place in the Inspector?
Thank you.
Can you double check that you actually have the InputField component (script) in the InputField game object.
First, maybe I should have stated it is a Text$$anonymous$$eshPro Input fiels. @CodesCove I tried to add InputField script to the InputFields game object, but I didn't found a script named InputField. Tried to add InputField to InputFields but, not surprisingly, I was not able to do it.
Well, I managed to fix it. By being a Text$$anonymous$$eshPro InputField, the fields in the script have to be T$$anonymous$$P_InputField, ins$$anonymous$$d of regular InputField. I changed the class of the fields in the script, and now it works.
Answer by Zymurer · Jul 01, 2020 at 06:51 PM
In fact,there is an alternative and you needn't to drag. Click the little circle at bar of your varible in the inpspector and pick the object you wish.
By the way, I do not think it is about assiging. It may be a bug or something in the scirpt causes it. Hope that helps.
Already tried, and nothing shows up. Thanks for answering, anyway.
Answer by SpellMender · May 05 at 09:54 PM
I've found the answer for myself. Its because I was using TextMesh Pro input fields. To resolve the issue change your InputField data type to TMP_InputField. You can only do this if you are using the TMPro namespace.
Your answer
