// Update is called once per frame void Update() { skyVisibilityMat.SetFloat("_SingleLightMultiplier", multiplierSingleLight); if (_lights == null) { if (_skyManager.GetDomeLightsGameObjects() != null) { _lights = _skyManager.GetDomeLightsGameObjects(); } } else { float total = 0; float half = 0; Light[] lights = _lights.GetComponentsInChildren <Light>(); foreach (Light lightComp in lights) { Vector3 lightDir = lightComp.transform.localToWorldMatrix * Vector3.back; float ns = Vector3.Dot(Vector3.Normalize(lightDir), Vector3.up); float hs = Vector3.Dot(Vector3.Normalize(lightDir), Vector3.left); if (ns > 0) { total += ns; } if (hs > 0) { half += hs; } } total = multiplierSingleLight * total / lights.Length; half = multiplierSingleLight * half / lights.Length; Debug.Log("Total: " + total.ToString()); Debug.Log("Half: " + half.ToString()); } }