I need a script to switch between two light sources, both children of the player. I have a code that can tell if it is time to switch the light sources, and to reset the variable after switching the lights. I just don’t know how to activate/deactive the game objects of the lights. The light sources are a sun and a torch.
using UnityEngine;
using System.Collections;
public class LightSourceManager : MonoBehaviour {
public bool switchLights = false;
void Update () {
if (switchLights) {
lightSwap ();
switchLights = false;
}
}
private void lightSwap () {
//Put code here
}
}