Figuring out if another boject is to my right or left

Hi, I’m building a 2d fighter and I’m having some trouble figuring out how to check what side each fighter is on.
I have a Boolean set for “OnLeft” So when its true, directions on the controllers swap along with materials ect, but I cant figure out the way for the game to detect this.
If someone could point me to the relevant documents on the scripting reference it would be helpful

Well, I suppose that your axis are X (horizontal) and Y (vertical), and your fighters follow the same coordinate system.

In each moment, a fighter has to be turned to the left, and the other has to be turned to the right (because they have to look at each other). Correct? :wink:

So, the “1UP” fighter has to start with OnLeft=true, because the controllable player is always in the left side of the screen, at the beginning. The “COM” fighter (controlled by CPU) has, naturally, OnLeft=false.

Then, at every moment, the fighter on the left is the one with the lower x coordinate in its transform!
So, you have to perform a test like this:

if (1P.transform.position.x < COM.transform.position.x)
   //Set 1P's variable to true and COM's variabe to false
else
   //Set 1P's variable to false and COM's variable to true