Stratis Dermanoutsos
Stratis Dermanoutsos

Reputation: 787

Unity: public InputField variable does not accept Input Field objects

I am trying to drag an Input Field object from Unity Hierarchy and store it inside a public InputField variable. However, while when I drag it, it shows that the object is indeed allowed to be stored, if I release the Input Field object, it does not get stored. and the variable is still showing "None (Input Field). Also, when I try to press the circle (the one in the red square) to see the list of available Input Field objects, the list is empty, which is impossible, as it remains empty no matter how many input fields I create.

enter image description here

The Input Field object contains an Input Field component so it indeed counts as Input Field but I cannot figure out any way to solve this.

Upvotes: 0

Views: 2659

Answers (3)

Husam Abu Zina
Husam Abu Zina

Reputation: 21

When you create a new gameobject, use the UI -> Legacy -> InputField.

This worked just fine for me!

Upvotes: 0

Gadi Kerbis
Gadi Kerbis

Reputation: 21

I had a similar problem. In UI there is a page called "Legacy" and choose to apply the input field It solved the problem for me.

Upvotes: 2

Stratis Dermanoutsos
Stratis Dermanoutsos

Reputation: 787

Turns out a wrong class InputField (don't know what or how) was used in the script so as suggested from @Kokosbrood, I used the whole path to the class UnityEngine.UI.InputField

Upvotes: 1

Related Questions