How to toggle Unity lights
Toggle lights by enabling or disabling the Light component directly rather than trying to access a nonexistent Renderer component.
- Attempting to access a Renderer component on a light object causes a console error because lights do not have renderers by default
- To toggle illumination on button press, enable or disable the Light component instead of searching for a renderer
- Using automated IDE features like auto-indentation prevents messy nesting and syntax scope confusion


