I am coding my game's collisions using onTriggerEnter()
.
The problem is that it only checks X and Y axis and not the Z one, and that is causing me some problems because my game uses the Z axis and I can't use 3D colliders for other reasons.
There is a way to check also the Z axis with onTriggerEnter or a similar function? At this moment my code is:
void OnTriggerEnter2D(Collider2D col)
{
Debug.Log("Collision Detected");
if(col.gameObject.tag == "Safe")
{
return;
}
else if(col.gameObject.tag == "Obstacle")
{
Debug.Log("Changing to Game Over scene");
GameController.GetComponent<SceneController>().gameOver();
}
}