1090629 常態的動作偵測
by 黃國哲
2020-06-29 22:43:54, 回應(0), 人氣(605)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class scriptest : MonoBehaviour
{
// Start is called before the first frame update
public Text Keyme ;
public Text tip ;
public Text tip2 ;
void Start(){}
// Update is called once per frame
void Update()
{
if (Keyme.text == "abc1")
tip.text= " Data ";
{
tip2.text=" No Data ";
}
}
}
2.這裡假設偵測的值為"abc1"
將public的內容Text拖曳到對應的物件
將Button輸出的值設定成abc1

3.執行程式,可以看見tip出現if的結果
而tip2顯示為No data (等待Debug ing)

回應