dimanche 3 décembre 2017

Working with Unity, Triggers not working

So i'm finishing up my Unity Project for school until i ran into this problem, the Triggers wont work if i try to make it detect the object's (that it is running into) name or tag.

void OnTriggerEnter2D() {
    if(gameObject.name == "AntiDome")
    {
    Debug.Log ("TESTX");
    }
}

This doesn't, and ive tried several alternatives with the same purpose, but

void OnTriggerEnter2D() {
    Debug.Log ("TESTX");
}

Works fine on its own, i have no clue why. I've been at this for hours and i really don't know what to do next.

Aucun commentaire:

Enregistrer un commentaire