public void ToggleScene() { DayScene.SetActive(!DayScene.activeSelf); NightScene.SetActive(!NightScene.activeSelf); Lighting.intensity = NightScene.activeSelf ? 0 : 1; for (int i = 0; i < lightbulbs.Length; i++) { lightbulbs[i].GetComponent <Light>().intensity = NightScene.activeSelf ? 2 : 0; } for (int j = 0; j < dronelights.Length; j++) { //dronelights[j].GetComponent<Light>().intensity = NightScene.activeSelf ? 1 : 0; } }
// Start is called before the first frame update void Start() { DayScene.SetActive(true); NightScene.SetActive(false); lightbulbs = GameObject.FindGameObjectsWithTag("bulb"); dronelights = GameObject.FindGameObjectsWithTag("drone_light"); for (int i = 0; i < lightbulbs.Length; i++) { lightbulbs[i].GetComponent <Light>().range = 16; lightbulbs[i].GetComponent <Light>().intensity = 0; } for (int j = 0; j < dronelights.Length; j++) { //dronelights[j].GetComponent<Light>().intensity = 0; } }