public class EnableComponents : MonoBehaviour
private Light myLight;
void Start ()
myLight = GetComponent<Light>();
void Update ()
myLight.enabled = !myLight.enabled;
What I Learned
In doing this tutorial I learned how to enable and disable components through a script which includes a toggle function through the space bar. Specifically, this tutorial showed me how to turn a light on and off through the script. One problem I had to solve was making sure my code was accurate and without errors. Otherwise this tutorial was pretty problem free.