Rotate object respect other object rotation

I need to rotate a game object to the exact opposite rotation of another game object

Your problem is not very clear.

If I understood right, this is what I would have done :

// C#

public GameObject object ;

public void Rotate()
{
    // Flip the rotation on the 3 axis
    transform.rotation = object.transform.rotation * Quaternion.Euler( 180, 180, 180 ) ;
}