I instantiate five to ten objects from the same prefab. These objects move down a road/trail and eventually pass through a wall (invisible, just there to detect passage). I have a “Counter” that is supposed to increment once each time one of my prefab objects pass through the wall.
The prefab objects have a rigidbody (for physics/movement) and a collider. My invisible wall has a collider.
No matter what I do, I can’t get the Counter to add up to more than one (I accidentally got it to add up to two for a short period of time but can’t even get it to do that now). I’m trying to figure out what my Inspector settings need to be to get my Counter to increment properly…it’s obviously working a teenie bit or it would never get to “1” at all. Hmmmm.
Here’s my OnTrigger code:
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag=="Finish")
{
Counter01++;
Debug.Log("Bingo " + Counter01);
}
}