Hi,
Iv made a puzzle, were u slide each part of the puzzle to make a picture.
Say I had a collider for each part of the puzzle and tags for each puzzle piece. Is there away to connect each trigger so wen all triggers are active they unlock a new gameobject?
Not sure what you mean. But am guessing yes. Certainly you can have some type of manager and a count which will know if all objects are active, or set to a particular value.
Thanks for your reply.
I was wondering if you can help me with my manager script? I have the list and gameObjects that I want to check if they are active or inactive. But i’m struggling with the code :
#pragma strict
var ActivePuzzlePieces:GameObject[ ]; // Active objects when each puzzle piece is in place (using triggers).
var EndPuzzleScene : GameObject; // Endscene after all puzzle pieces are in the correct place.
function Start()
{
}
function Update () {
for(var i = 0;i<ActivePuzzlePieces.length;i++) { // List of active/inactive objects when puzzle pieces activate them.
if (ActivePuzzlePieces*.active = true); // if all pieces of the puzzle are active?*
-
EndPuzzleScene.SetActiveRecursively(true); // when all pieces are active = true then unlock endscene.*
-
Debug.Log (“Active”, gameObject);*
_ else (ActivePuzzlePieces*.active = false); // if they are not active?*_
* EndPuzzleScene.SetActiveRecursively(false); // keep endscene false.*
Debug.Log (“Inactive”, gameObject);
}
}
You are using end of line statements in the wrong place.
if (ActivePuzzlePieces_.active = true); is wrong, it should be if (ActivePuzzlePieces*.active = true) and you should also be using braces for the if and else._
_```*_
*if (ActivePuzzlePieces[i].active == true) { // if all pieces of the puzzle are active?
EndPuzzleScene.SetActiveRecursively(true); // when all pieces are active = true then unlock endscene.
Debug.Log (“Active”, gameObject);
} else { // if they are not active?
EndPuzzleScene.SetActiveRecursively(false); // keep endscene false.
Debug.Log (“Inactive”, gameObject);
}
_*_ _*but in your situation, you could do this*_ _**_
*var ActivePuzzlePieces:GameObject; // Active objects when each puzzle piece is in place (using triggers).
var EndPuzzleScene : GameObject; // Endscene after all puzzle pieces are in the correct place.
var flag : boolean; //Determines whether to load the end scene. True == Do not load the end scene, false = load the end scene
function Update() {
flag = false;
for (var i = 0;i<ActivePuzzlePieces.length;i++) {
if (ActivePuzzlePieces[i].active == false){ //Check if any piece is inactive, if they are we set flag to true.
flag = true;
}
}
if (flag == false) //If it is false, load the endscene
EndPuzzleScene.SetActive(true);
}
_```*_
I do not use Unityscript, so not sure exactly what it’s capable of and much of the syntax with it 
NOTE This was rushed and not thought through in anyway.
Thank you so much for your help, Still getting my head around scripting.
I know what i want to do and the logic behind it, it’s just writing the code.
Thanks again.