private void CheckLightLevel() { Light[] lights; lights = FindObjectsOfType(typeof(Light)) as Light[]; currentLightLevel = 0f; foreach (Light light in lights) { LightSource source = light.GetComponent <LightSource>(); if (source != null) { currentLightLevel += source.LightOnObject(transform); } } //Debug.Log(currentLightLevel); }