首页 > 代码库 > IsRenderingOrNot

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");
//}


}

}

IsRenderingOrNot