0

I'm a bit new to Unity, and i just want to know, how can i check if an inputfield is equal to a word or some kind of code, or what i specify?

I tried whith something like:

if(inputfield == "Money")

but i didn't see it working:D

Kalip
  • 151
  • 1
  • 11

1 Answers1

2

You just need to call the text portion of it

if (inputfield.text == "Money")
Dylan Lawrence
  • 1,503
  • 10
  • 32
  • Yes as this gentleman says, you need to access the text property. Each UI element in Unity has a number of properties you can access, keep that in mind should you need access to another. – Mr.Bigglesworth Oct 13 '16 at 15:00
  • How can i check, if the player types something else in the inputfield? – Kalip Oct 13 '16 at 15:17
  • @kalip Something specific? You would do the same way. There's also functions to check if the text field has changed. – Dylan Lawrence Oct 13 '16 at 15:49
  • @DylanLawrence I did it, i'm trying to figure out how can i open the mobile keyboard, once the inputfield is clicked.. – Kalip Oct 13 '16 at 15:53
  • @Kalip I haven't done too much mobile but I think it should just open on its own. – Dylan Lawrence Oct 13 '16 at 15:55
  • @dylanLawrence I think that too, but it just doesn't, maybe because of IOS? – Kalip Oct 13 '16 at 15:57