✅ How to reference gameObject in OnCollisionEnter2D?
I don't want to detect collision of the game object the script is tied to, I want to detect collision of an instantiated object called _cell. How do I reference _cell in the collision function?
public void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "wall_up")
{
Debug.Log("Collision detected!");
}
}