J'ai fait ceci :
Code : Tout sélectionner
public GameObject Soupe;
public Transform transform;
public bool Carotte = false;
public bool Poireau = false;
void OnTriggerEnter (Collider col)
{
if (col.gameObject.tag == "Carotte")
{
Carotte = true;
}
if (col.gameObject.tag == "Poireau")
{
Poireau = true;
}
if (Poireau == true && Carotte == true)
{
Instantiate (Soupe, transform.position, Quaternion.identity);
//Destroy Carotte et poireau
}
}