IsRenderingOrNot

using UnityEngine;
using System.Collections;

public class Rendering : MonoBehaviour {

public bool isRendering = false;//是否被摄像机渲染
private float lastTime = 0;//
private float curtTime = 0;//
void Update()
{
isRendering = curtTime != lastTime ? true : false;
lastTime = curtTime;
}
void OnWillRenderObject()
{
// if (Camera.current.name == Camera.main.name)//是需要渲染的摄像机
// {
curtTime = Time.time;
Debug.Log("isRendering");
//}

}

}

时间: 2024-11-26 08:01:35

IsRenderingOrNot的相关文章