using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 方向展示UI 控制器 /// public class DirIndicatorCtrl : MonoBehaviour { public GameObject indicatorImage;//指针UI private Transform target; // Start is called before the first frame update void Start() { } /// /// 设置待指示方向的目标 通常是摄像机 /// /// public void SetTarget(Transform target) { this.target = target; } // Update is called once per frame void Update() { if (target) { indicatorImage.transform.localEulerAngles = new Vector3(0, 0, -target.eulerAngles.y); } } }