I’m trying to pass a function to add in OnValueChanged but it remains empty.
public class MyScript : MonoBehaviour
{
public void InputValue(List<UnityAction<string>> inputListeners)
{
...
if (inputListeners != null && i < inputListeners.Count)
{
Debug.Log("Tic");
inputfield.onValueChanged.AddListener(inputListeners*);*
}
}
public void OnInputValueChanged(string input)
{
…
}
}
public class OtherScript : MonoBehaviour
{
void Start()
{
myScript.InputValue(new List<UnityAction> { myScript.OnInputValueChanged });
}
}