So i’m trying to control multiple booleans from a script on a parent object.
i got it to access and turn on the boolean that i wanted but it turns on all of the objects with the same script…
i’m wonder if it’s even possible to control the individual child objects with the same script.
here is my code so far…
this is the script that i want to manage the child objects
var isLooping = false;
var Delay = 2;
function Start(){
//loop at start
isLooping = true;
//Test
yield WaitForSeconds(2);
spin.Spin = true;
}
function Update(){
}
this is the script that controls the child objects.
static var Spin = true;
var Speed = 4.0;
var Clip : AudioClip;
function Start(){
Spin = false;
audio.loop = true;
}
function Update(){
audio.clip = Clip;
//if true spin chakra and play audio with it.
if(Spin){
transform.Rotate(Vector3(0,-1,0) * Speed);
if(!audio.isPlaying){
audio.Play();
}
}
//if false stop spinning and stop audio.
else if(!Spin){
transform.rotation = Quaternion.Euler(-90, 0, 0);
audio.Pause();
}
}