using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 当前物体是否在相机渲染范围内 /// public class ObjVisableInCam : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } #region 可见性判断 public bool IsVisableInCamera { get; private set; } private void OnBecameVisible() { IsVisableInCamera = true; } private void OnBecameInvisible() { IsVisableInCamera = false; } #endregion }