Hi,
I have four cubes which are close to each other. when my ball hit between two cube. OncollisionEnter Function detect twice at the same time and my score increase twice in single hit.
all cubes are tag with same name.
How to solve this issue?
void OnCollisionEnter(Collision collisionObject)
{
if(collisionObject.gameObject.tag == "Cube" )
{
string points = collisionObject.gameObject.name;
switch(points)
{
case "Cube1":
gameDataRef.score += 100;
break;
case "Cube2":
gameDataRef.score += 50;
break;
case "Cube3":
gameDataRef.score += 60;
break;
case "Cube4":
gameDataRef.HitScore += 80;
break;
}
}
}