using System.Collections; using System.Collections.Generic; using UnityEngine; public class ZoneUI : MonoBehaviour { public Camera _camera; public Transform target; public Vector3 offset=Vector3.zero; private Vector3 startScale; public bool isScreen = true; Vector3 pos; private void Start() { _camera = GameObject.FindGameObjectWithTag("MainViewCamera").GetComponent(); startScale = transform.localScale; } public void Update() { if (isScreen) { pos = _camera.WorldToScreenPoint(target.position); } else { pos = target.position; transform.localScale = startScale * GameManagerForZhuanWan.Instance.tipScale; transform.LookAt(_camera.transform); } transform.position = pos + offset; //transform.LookAt(_camera.transform); } }