ElectricityBusinessHall_Dig.../Assets/Resources/Scripts/Function/ObjVisableInCam.cs

34 lines
599 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 当前物体是否在相机渲染范围内
/// </summary>
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
}