检测是否渲染

// Detects manually if anObject is being seen by the main camera

var anObject : GameObject;
private var cam : Camera;
private var planes : Plane[];

function Start() {
cam = Camera.main;
planes = GeometryUtility.CalculateFrustumPlanes(cam);
}

function Update() {
if(GeometryUtility.TestPlanesAABB(planes,anObject.collider.bounds))
Debug.Log(anObject.name + " has been detected!");
else
Debug.Log("Nothing has been detected");
}

你可能感兴趣的:(渲染)