ScottishTapWater
ScottishTapWater

Reputation: 4786

Triggers not Triggering, Unity

I have set up a system whereby in the middle of each square of my chessboard there is an unrendered circle which has two colliders on it. One just allows it to collide with the board so it doesn't fall through, the other (bigger one) is a trigger. I am planning on using these triggers to determine which square the relavent pieces are on for my chess game.

However, none of the triggers appear to be triggering. Every piece has a collider and a rigidbody as required by the documentation. I have been trying for hours to get this to work but to no avail. I have tried jiggling with the rigidbodies and the colliders but nothing seems to work.

The test code I am using is extremely simple and is attached to each Circle:

public class Trigger : MonoBehaviour {

void onTriggerEnter(Collider other)
{
    Debug.Log("Trigger Enter");
}
void onTriggerStay(Collider other)
{
    Debug.Log("Trigger Stay");
}
void onTriggerExit(Collider other)
{
    Debug.Log("Trigger Exit");
}
}

Any help would be hugely appreciated because I'm completely stumped at the moment.

Screenshot of Unity

Upvotes: 2

Views: 150

Answers (1)

ScottishTapWater
ScottishTapWater

Reputation: 4786

Highly embarassing but I guess it can catch the best of us. Rather than deleting the question I thought, as this appears to be a common proble, I would post the solution here.

onTriggerEnter needs to be OnTriggerEnter etc. Got to love case sensitive code!

Guess my attention to detail needs to improve.

Upvotes: 1

Related Questions