Graphic.Raycast generating CS0120

I’m trying to use Graphic.Raycast() to check for UI elements in front of my cursor, but it causes error CS0120 - “An object reference is required for the non-static field, method, or property ‘Graphic.Raycast(Vector2, Camera)’”

Here’s my exact code:

Graphic.Raycast(Input.mousePosition, mainCamera);

I haven’t been able to find much about this particular function online so it’s possible I’m misusing it

“Graphic” for “Graphic.Raycast” needs to be a specific graphic, rather than the class name.
So you need a reference rather than “Graphic”