TaiZhouChangChu/Assets/Script/LH/InputSet.cs

29 lines
651 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InputSet : MonoBehaviour
{
public string rightAnswer;
public GameObject showObj;
private InputField input;
// Start is called before the first frame update
void Start()
{
input = this.GetComponent<InputField>();
input.onValueChanged.AddListener((string content) => { DoRightAction(content); });
}
// Update is called once per frame
void Update()
{
}
private void DoRightAction(string content)
{
showObj.SetActive(content == rightAnswer);
}
}