how to separate differents triggers

hi men.
i have a big problem, but there’s 2 solutions. I explain the situation: i have 2 players and i must check if the two one is in the end of the level.
here is the solutions:

  1. you can use 1 trigger and check if there 2 entity inside, but i don’t know how to do this

  2. you can use 2 triggers and chech if they contain 1 entity each. (sorry for my bad english, I’m French and i hope you understand me). but here agen i don’t know how to “separate” triggers.
    i have a begining of code.
    here is:

    #pragma strict

    var cible : GameObject;
    var trigger1 : GameObject; //i put the trigger1 here
    var trigger2 : GameObject; //i put the trigger2 here
    private var interrupteur1: boolean; //interrupteur is button in french
    private var interrupteur2: boolean; //interrupteur is button in french

    function Start () {
    interrupteur1 = false;
    interrupteur2 = false;
    }

    function OnTrigger1Stay2D() {

     	interrupteur1 = true;
    

    }

    function OnTrigger2Stay2D() {

     	interrupteur2 = true;
    

    }

    function OnTriggerExit2D() {

     interrupteur1 = false;
     interrupteur2 = false;
    

    }

    function Update ()
    {
    if(interrupteur1 == true){
    if(interrupteur2== true){
    cible.transform.Rotate(Vector3.forward*(100.0Time.deltaTime1));
    }
    }
    }

please help me, because i’m on this javascript sins 2 weeks and I can’t find what i surch.

thank you :slight_smile:

you can do this with 1 trigger but you need to tag players and make your script like this:
#pragma strict

var cible : GameObject;
private var interrupteur1: boolean;
private var interrupteur2: boolean;

function Start () {
	interrupteur1 = false;
	interrupteur2 = false;
}

function OnTriggerStay2D(other : Collider2D) {

	if(other.tag == "Player1"){
		interrupteur1 = true;
	}
	if(other.tag == "Player2"){
		interrupteur2 = true;
	}
}

function OnTriggerExit2D() {

	interrupteur1 = false;
	interrupteur2 = false;

}

function Update (){

	if(interrupteur1 == true){
		if(interrupteur2 == true){
			 Destroy(cible);
		}
	}
}

that’s it :slight_smile: