Home > Mobile >  Can't add an Empty object to a script variable
Can't add an Empty object to a script variable

Time:09-06

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

CodePudding user response:

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.

  • Related