纳金网
标题:
判断物体是否在相机中渲染
[打印本页]
作者:
狂风大尉
时间:
2015-2-10 00:47
标题:
判断物体是否在相机中渲染
判断物体是否在相机中渲染的代码:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
public bool isRendering=false;
private float lastTime=0;
private float curtTime=0;
void Update (){
isRendering=curtTime!=lastTime?true:false;
lastTime=curtTime;
}
void OnWillRenderObject (){
curtTime=Time.time;
}
}
复制代码
欢迎光临 纳金网 (http://rs.narkii.com/club/)
Powered by Discuz! X2.5