Вот код, который я использовал, но он не работает должным образом:
Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InputFieldComparision : MonoBehaviour
{
public InputField inputFieldInMainUi;
private string Txt;
void Update()
{
Txt = inputFieldInMainUi.text.ToUpper();
Debug.Log(Txt);
#region comparison
if (Txt == "MR")
{
Debug.Log("Move Right");
}
else if (Txt == "MM")
{
Debug.Log("move middle");
}
else if (Txt == "ML")
{
Debug.Log("move left");
}
else if (Txt == "J")
{
Debug.Log("jump");
}
else if (Txt == "M")
{
Debug.Log("menu");
}
else if (Txt == "Q")
{
Debug.Log("quit");
}
#endregion
}
}
Подробнее здесь: https://stackoverflow.com/questions/754 ... roperly-un