Detect cursor on edge of screen

I’m not working on anything that needs this script right now but I am curious, does anyone know a script for detecting when the mouse hits the edge of the screen? Examples of the script I’m looking for are found in top-down strategy games like Civilization 5 and Starcraft 2. I’m not looking for the camera scrolling mechanic itself, just the code to detect the mouse on the edge of the screen.

You can use Input.mousePosition to detect where is your cursor Unity - Scripting API: Input.mousePosition

For example:

public class RTScamera : MonoBehaviour

{

public float ScrollSpeed = 15;

}

// Update is called once per frame
void Update()
{				             
       if ( Input.mousePosition.y >= Screen.height *0.95)
        {
            transform.Translate(Vector3.right * Time.deltaTime * ScrollSpeed, Space.World);
        }
       
} 

}