so i want to make a 2d game where when player collides with spike it triggers something (for now i want debug.log to trigger just to be sure)
void OnCollisionEnter2D(Collision2D trig)
{
if (trig.gameObject.tag == "Enemy")
{
Debug.Log("player touches enemy");
}
well if it shows the code bad sorry.
so, i am trying to detect the tag of the Enemy (spike) and make a trigger.
after that i will put a die script.
↧