/*
For this to work, both objects (Player and something that it touches) must have
Any Collider2D component enabled
*/
// If none of them have trigger on.
void OnCollisionEnter2D(Collision2D other)
{//this is how to get name of the other object
string otherObjectName = other.gameObject.name;
//this is how to get tag of the other object
string otherObjectTag = other.gameObject.tag;
}
// If at least one of them has Trigger on, use this function instead.
void OnTriggerEnter2D(Collider2D other){
}