using System.Collections; using System.Collections.Generic; using UnityEngine; public class LightOnOffUpdate : MonoBehaviour { public bool lightIsOn; // You can change from the inspector if you want the light to be on or off as the default. [SerializeField] private GameObject _lightΒulbs; private Light[] _light; private Renderer[] _lightRend; private SanityActivation[] sanity; private LightBulbEmissionUpdate lightBulbEmissionUpdate; //float _lightRend. //void Awake() //{ // lightBulbEmissionUpdate //} public void LightOn() { lightIsOn = true; foreach (Light light in _light) { light.enabled = true; } //_light.enabled = true; foreach (Renderer renderer in _lightRend) { renderer.material.EnableKeyword("_EMISSION"); } foreach (SanityActivation sanity in sanity) { sanity.EnableSanityTrigger(); } print("Light is on"); } }