// Start is called before the first frame update void Start() { var input = gameObject.GetComponent <TMP_InputField>(); var submitEvent = new TMP_InputField.SubmitEvent(); submitEvent.AddListener(SubmitName); input.onEndEdit = submitEvent; }
// Start is called before the first frame update void Start() { //stgnumgApers = "0"; //msgEnv = panel1.GetComponent<TMP_InputField>(); escMsg = new TMP_InputField.SubmitEvent(); escMsg.AddListener(escrMsg); msgEnv.onEndEdit = escMsg; }
void Start() { t = GameObject.FindWithTag("Moving").GetComponent <Transform>(); input = GetComponent <TMP_InputField>(); var se = new TMP_InputField.SubmitEvent(); se.AddListener(ChangeHeight); input.onEndEdit = se; //or simply use the line below, // input.onEndEdit.AddListener(SubmitName); // This also works }
void Awake() { szScoreTextFile = Application.dataPath + "scores.txt"; //saveScore(); //add listener var subEvent = new TMP_InputField.SubmitEvent(); subEvent.AddListener(storeName); if (input != null) { input.onEndEdit = subEvent; } scoreCount.text = fCurrentScore.ToString(); g = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>(); }
private void Start() { if (gameObject.tag == "visita") { nvisit = this.gameObject.GetComponent <TMP_InputField>(); escribe1 = new TMP_InputField.SubmitEvent(); escribe1.AddListener(EnvInfvisit); nvisit.onEndEdit = escribe1; } if (gameObject.tag == "gAPerson") { ngAperson = this.gameObject.GetComponent <TMP_InputField>(); escribe2 = new TMP_InputField.SubmitEvent(); escribe2.AddListener(EnvInfgAper); ngAperson.onEndEdit = escribe2; } }
/// <summary> /// <para>リスナーを追加します</para> /// <para>この関数は AddListener 関数の省略表記です</para> /// </summary> public static void Add(this TMP_InputField.SubmitEvent self, UnityAction <string> call) { self.AddListener(call); }
//================================================================================ // 関数(static) //================================================================================ /// <summary> /// リスナーを設定します /// </summary> public static void SetListener(this TMP_InputField.SubmitEvent self, UnityAction <string> call) { self.RemoveAllListeners(); self.AddListener(call); }