天天看点

[unity3d]判断物体是否在视角内(巧妙!)

public var isRendering:boolean=false;

private var lastTime:float=0;

private var curtTime:float=0;

function Update()

{

isRendering=curtTime!=lastTime?true:false;

lastTime=curtTime;

}

function OnWillRenderObject()

{

curtTime=Time.time;

}

如此简单!如此巧妙!!

继续阅读