(スクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CursorPos : MonoBehaviour
{
private Vector3 pos;
public GameObject box;
void Update()
{
pos = Input.mousePosition;
if(pos.y > 500)
{
box.GetComponent<MeshRenderer>().material.color = Color.red;
}
else
{
box.GetComponent<MeshRenderer>().material.color = Color.green;
}
print(pos);
}
}
(実行結果)

