How to use the “On Value Change” in Unity3D Input Field UI component

后端 未结 2 1786
说谎
说谎 2021-01-05 15:44

I\'m following a tutorial on how to work with Unity3d and I\'ve hit a dead end.

I believe something changed in a newer version of Unity since the tutorial seems to w

相关标签:
2条回答
  • 2021-01-05 16:20

    with your comment you just made it all clear. When you use the Dynamic Parameter, the value of your input entry is passed to your function. When you choose the Static Parameter, a new input box is shown in the inspector, for you to write the "static parameter" you want to receive.

    Not sure yet how this is useful. But it should make clear the difference.

    0 讨论(0)
  • 2021-01-05 16:33

    Yes you can add event handlers via the inspector. Select the InputField game object and scroll down to the bottom of the InputField section in the inspector. Click + to add a new event handler then select the receiving game object and method you want to call.

    Use the Dynamic string version of the function to pass the input string as a parameter. The Static Parameters callbacks let you set the function parameter in the inspector, which likely isn't what you want when responding to InputField changes.

    enter image description here

    0 讨论(0)
提交回复
热议问题