Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't add an Empty object to a script variable

I may have said something wrong, I’m not really familiar with Unity. The thing is that I made a Lobby scene for multiplayer with PUN and I have 2 input fields + 2 buttons. Then I created an empty named "CreateAndJoinRooms" which has the "CreateAndJoinRooms" script. I need to drag the CreateInput and the JoinInput to the "Create Input" and "Join Input" fields, but it doesn’t let me.

Unity Error Video

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Reason for this class of problems is always the same: the types of field and components in object you are trying to drag mismatch.

Either you are dragging an empty parent/incorrect child without given component, or the component of your GO doesn’t match the type of the field (or doesn’t inherit from the type).

In your case, it looks like you are using Text Mesh Pro version of the input field, but trying to assign it to regular input field.

Use TMP_InputField as a type for your variable in your script instead.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading