- Home /
 
Turn off multiple lights
I am trying to make a script that when triggered it disables one tag and enables another this what I have so far
 using UnityEngine;
 using System.Collections;
 using UnityEngine.SceneManagement;
 
 public class InteractScript : MonoBehaviour
 {
     public float interactDistance = 5f;
     public AudioClip SoundToPlay;
     public float Volume;
     AudioSource audio;
     public bool alreadyPlayed = false;
 
 
     void Update ()
     {
         if(Input.GetKeyDown(KeyCode.E))
         {
             Ray ray = new Ray(transform.position, transform.forward);
             RaycastHit hit;
             if (Physics.Raycast(ray, out hit, interactDistance))
             {
                 if (hit.collider.CompareTag("Door"))
                 {
                     hit.collider.transform.GetComponent<DoorScript>().ChangeDoorState();
                 }
                 else if (hit.collider.CompareTag("nextlevel"))
                 {
                     gameObject.tag == "pointlight" tag.SetDeactive(false); // or 
 false
                     gameObject.tag == "enemy1" tag.SetActive(true); // or True
                 }
             }
         }
     }
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Disable/Enable tag groups leaving lower level. 0 Answers
How do I enable and disable multiple game objects in Unity? 1 Answer
enable/disable child objects? 2 Answers
Disable a GameObjects scripts knowing only the GameObjects name 3 Answers
Disabling first actor when switching to another camera. 0 Answers