Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

InputField events not passing text?

Discussion in 'UGUI & TextMesh Pro' started by CanadianCheese, Mar 10, 2015.

  1. CanadianCheese

    CanadianCheese

    Joined:
    Mar 10, 2015
    Posts:
    12
    Hi there!

    So I am attempting to use an inputfield UI element, and an event, to pass its changed value to a script. I get the event, but the parameter is not correct.

    It seems there is a field in the event panel in the inspector that I can enter a hard coded value, which is obviously not useful. I would expect that OnValueChanged(string) or EndEdit(string) would include the value of the text field.

    Am I missing something obvious?
     
    CaJa-i likes this.
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    You have to choose your function under the "Dynamic string" section of the event to receive the input text.
    If you choose your function under the Static Parameter section you can set a static value over the event inspector.

    Make sure that your function or parameter is public in order to show in the function / parameter list.
     
    OneTo11, Beloudest, CaJa-i and 12 others like this.
  3. Beloudest

    Beloudest

    Joined:
    Mar 13, 2015
    Posts:
    245
    This is so silly... Thanks