点击Button(2),更改Text文字内容
创建脚本:iage_aph,Find()里面是Text地址。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class iage_aph : MonoBehaviour {
public void hit_test() {
GameObject.Find("Canvas/win/Image/Text").GetComponent<Text>().text = "你想写的内容";
}
}
将脚本拖到Text的Inspector面板上
之后对Button(2)的Inspector面板,行如下配置: