c# 2d How to compare two GameObjects ?


I am trying to compare a GameObject that is inside an array of GameObjects (which is the map) to just another GameObject, in this case I am trying to see if where the player stands in the map is water, but
even when I know for sure it is water they don’t compare. can you plz help me ? , this is my code:

(a script)

public static GameObject[] map;
map = new GameObject[10];

(b script)

map[0] = Water;

(c script)

if (map[0] == Water) {
			print ("Works");
		} else {
			print ("Doesn't Work");

Well if you just want to compare two game objects you can either compare them by their names or tags or on which layer the two objects are. In your case i would agree with @Rushikesh988. You should consider the bounds!!