Answer the question
In order to leave comments, you need to log in
How to activate scripts of other objects in a script?
The script should work like this, when a certain key is pressed, the Light (Sphere) activation script is triggered, and also when another key is pressed, another Light (Sphere (1)) is activated (the script must be independent of these objects)
Main script code
using UnityEngine;
using System.Collections;
public class TimeLightsScript : MonoBehaviour {
public GameObject[] light;
private
void Start () {
light = GameObject.FindGameObjectsWithTag ("MainLight");
}
void Update () {
}
}
using UnityEngine;
using System.Collections;
public class TimeLightsScript : MonoBehaviour {
public GameObject[] light;
private
void Start () {
light = GameObject.FindGameObjectsWithTag ("MainLight");
}
void Update () {
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question