unity input field on value change code example
Example 1: change the text of inputfield unity
using UnityEngine.UI;
public InputField example;
public string textToPutToInputField = "If I helped you don't forget to upvote!";
public void SetTheText()
{
example.text = textToPutToInputField;
}
Example 2: unity inputfield onvaluechanged
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Example : MonoBehaviour
{
public InputField mainInputField;
public void Start()
{
mainInputField.onValueChanged.AddListener(delegate {ValueChangeCheck(); });
}
public void ValueChangeCheck()
{
Debug.Log("Value Changed");
}
}