Hey guys and girls
Just asking a question in regards to a sort of quest system in JavaScript
I Currently have two objects
Sphere 1 and Sphere 2
these two spheres both have colliders around them as shown below,
I want the player to walk through both colliders
then set both the spheres to SetActive = false
easy enough, but then I want it too check when the player walks into a collider if the other object is false, so if I walk into sphere 1 then check to see if sphere 2 is SetActive = false
if the sphere reads as false, turn on another collider(not shown in the image)
this is what I am currently using, two scripts, one on each collider around Sphere1 and Sphere2
var collider1 : GameObject;
var Sphere1 : GameObject;
function OnTriggerEnter ()
{
Sphere1.SetActive (false);
if(GameObject.FindWithTag("Sphere2").SetActive == false)
{
collider1.SetActive (true);
}
}
var collider1 : GameObject;
var Sphere2 : GameObject;
function OnTriggerEnter ()
{
Sphere2.SetActive (false);
if(GameObject.FindWithTag("Sphere1").SetActive == false)
{
collider1.SetActive (true);
}
}
not sure where I am going wrong but any help would be greatly appreciated
thanks!

You should check if object is active using GameObject.activeInHierarchy. So your if statement becomes: if(Heart.activeInHierarchy == false) { collider1.SetActive (true); collider2.SetActive (true); Debug.Log ("heart and feather found"); }
– HarshadKahh okay I put my if statement as
– soulboundif(GameObject.FindWithTag("Sphere2").activeInHierarchy == false)and it wasn't working that makes more sense thanks again!