I wanted to do Occlusion Culling on my Scene but I just get a bunch of Errors like "Couldn't load geometry..." etc. I tried to do like another way but the same thing, the Occlusion Culling just disables the Objects the Camera dont see. I tried it with OnTriggerEnter and Exit.
I have 2 Areas one is on the left and one on the right, when the Player is walking in the first Area the Box Collider checks it and disables the Objects in Area2 but when Player is walking into Area2, Objects in Area1 disables and Different. Got the Script on both Areas that it disables a list of arrays as GameObjects.
My Question is, does this save performance ?
public GameObject[] deactivatingModels;
bool playerEntered = false;
void OnTriggerEnter (Collider other)
{
foreach(GameObject envis in deactivatingModels)
{
if(other.gameObject.tag == "OcclusionCuller")
{
envis.SetActive(false);
Debug.Log ("Player has entered Occuling Zone");
}
}
}
void OnTriggerExit(Collider other)
{
foreach(GameObject envis in deactivatingModels)
{
if(other.gameObject.tag == "OcclusionCuller")
{
envis.SetActive(true);
Debug.Log ("Player has left Occuling Zone");
}
}
}