Question by 
               Matt27832 · Jul 23, 2019 at 10:45 PM · 
                c#scripting problemlightingtoggleflashlight  
              
 
              Disable light not working
I am making a flashlight with a spotlight on it when I press f it doesn't toggle I need help. It says in the script component.light is depreciated. What is the new way to get the light component. using System.Collections; using System.Collections.Generic; using UnityEngine;
 public class Flashlight : MonoBehaviour
 {
     private bool isOn = true;
     private bool hasFlash = false;
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void Update()
     {
         if (Input.GetKeyDown(KeyCode.F))
         {
             if(isOn == true)
             {
                 isOn = false;
                 light.enabled = false;
 
 
 
             }
             if(isOn == false)
             {
                 isOn = true;
                 light.enabled = true;
 
 
             }
         }
     }
 }
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                