using UnityEngine;
using UnityEngine.UI;
public class MouseClick: MonoBehaviour
{
public static Text txt;
public static float Count = 0;//初始点击次数
// Start is called before the first frame update
void Start()
{
txt = GameObject.Find(“Text”).GetComponent
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonUp(0))
{
Count += 1;
txt.text = “点击次数” + Count;
}
}
}
//放到Text组件上
Unity获取鼠标点击次数
最新推荐文章于 2024-04-16 17:31:32 发布