using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; public class Playermove : MonoBehaviour { public float speed = 300f; // 移动速度 [SerializeField] GameObject Player; bool moveLeft; private void Update() { if (moveLeft){ Player.GetComponent().rotation =Quaternion.Euler(0, 180, 0); Player.GetComponent().Translate(speed*Time.deltaTime,0,0); } } public void MOuseDown(){ moveLeft = true; } // 当按钮松开时调用 public void MOuseUP(){ moveLeft = false; } }