Immediate GUI (onGUI) control overlapping with camera motor

Hello.

There are dozens of posts on how to prevent your GUI command from propagating through your GUI. I read almost all of them and incorporated them into my script to solve the problem I am experiencing. But none of them fully resolves my issue. (I guess this is the limit of a script kiddy)

So in one of the scripts, I have a multislider control which controls an animation and texture of an object with a horizontal slider. I use immediate GUI (function OnGUI) for this and it adjusts the play time and texture setting according to the slider value.

Now the problem is that when I touch to control the slider, the touch is also being registered by the camera motor I have (a separate script). I have a camera motor that rotates its view when mousePosition change occurs over a specific threshold. So basically, it is a problem with GUI command propagating through the GUI. Bellow are the codes:

multislider control:

function OnGUI() {
  GUI.skin=skin;
  //Horizontal slider
  GUILayout.BeginArea (Rect (200,Screen.height-100, 600, 300));
  hSliderValue=GUILayout.HorizontalSlider(hSliderValue, 0.0, myANimation.length-0.07f,GUILayout.MaxWidth(600.0f));
  GUILayout.Label(sliderName);
  GUILayout.EndArea();
  Debug.Log("id: "+GUIUtility.hotControl);
}

camera motor:

public static Rect mulsliderRect = new Rect(100, 1400, Screen.height-100, 500);

private void Update()
  {
  bool GUICheck = mulsliderRect.Contains(Input.mousePosition);
  if (Input.GetMouseButtonDown(0) && GUIUtility.hotControl==0 && GUICheck==false)
      touchPosition = Input.mousePosition;

  if (Input.GetMouseButtonUp(0) && GUICheck==false)
     {
         float swipeForce = touchPosition.x - Input.mousePosition.x;
         if (Mathf.Abs(swipeForce) > swipeResistance)
        {
            if (swipeForce < 0)
               SlideCamera(true);
            else
                SlideCamera(false);
        }
    }
  }

  private void FixedUpdate()
  {
      bool GUICheck = mulsliderRect.Contains(Input.mousePosition);
      if (GUICheck == false)
      {
         desiredPosition = lookAt.position + offset;
         transform.position = Vector3.Slerp(transform.position, desiredPosition, smoothSpeed *   Time.deltaTime);
         transform.LookAt(lookAt.position);
       }
  }

I have used a mix of GUIUtiltiy.hotControl and rect.contains to fix this problem. But even with this fix, camera still rotates when I play with the slider. Interesting observation though is that when I rotate the camera first and then move the slider, its overlap is partially blocked. For example, when I rotate the camera to the right and then move the slider to the right, slider to the right is blocked. But slider to the left will rotate the camera to the left still. When I rotate the camera to the left, slider move to the left will not affect the camera.

I read that EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId) is the current trend but I am not quite sure how I can incorporate the event trigger system to my situation. .HitTest does not work on immediate GUI. What am I missing here and is there any suggestion?

thank you. didnt know how to do it. now I do

Just for archiving,
The solution to my problem was the inverted GUI screen coordinate.
so a bool that checks if mousePosition is .Contains in certain Rect works. Just mind the fact that GUI coordinates are inverse of that of input.

Following are references:

As for the reason why there was a weird phenomenon with directionality, it is unclear.
Using Immediate GUI seems to have more problem than convenience.