Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davehampson/56ffea653f0b88d64d01d2db23a11fe1 to your computer and use it in GitHub Desktop.
Save davehampson/56ffea653f0b88d64d01d2db23a11fe1 to your computer and use it in GitHub Desktop.
// Workaround for 1087657 https://issuetracker.unity3d.com/issues/android-cullallvisiblelights-consume-too-much-cpu-when-only-baked-lights-are-used-in-the-scene
Light[] lights = (Light[])GameObject.FindObjectsOfType(typeof(Light));
for (int i = 0; i < lights.Length; i++)
{
Light light = lights[i];
if (light.type == LightType.Point || light.type == LightType.Spot) // Assuming all your baked lights are these types
light.gameObject.SetActive(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment