- Home /
Question by
rvilgalys · Nov 26, 2017 at 08:14 PM ·
scripting problemscriptableobject
Why is this IEquatable always solving false?
I have an class to handle the connections between nodes. The nodes are Scriptable Objects.
public class MapNodeConnection : IEquatable<MapNodeConnection> {
public MapNode pointA;
public MapNode pointB;
public MapNodeConnection (MapNode newA, MapNode newB)
{
pointA = newA;
pointB = newB;
}
public bool Equals(MapNodeConnection other)
{
return ((pointA == other.pointA && pointB == other.pointB) || (pointB == other.pointA && pointA == other.pointB));
}
}
The equals function / operator is solving to false every time. I cannot figure this one out. Even something like this is returning false:
MapNodeConnection testConnect1 = new MapNodeConnection(nodeA, nodeB);
MapNodeConnection testConnect2 = new MapNodeConnection(nodeA, nodeB);
Debug.Log("test thing result:" + (testConnect1 == testConnect2));
What am I missing here?
Comment