How to get global mouse coordinates

Godot Version

4.2 Mono (C#)


I want to get the global mouse coordinates but an error occurs, VS Code tells me that the method does not exist. Looking at the official documentation, I found a method in GDScript and C#, but the method in C# doesn’t work (it doesn’t exist). I can’t use GDScript due to project peculiarities.

From which class do you try to call it?
It is available in nodes that inherit from CanvasItem.

I inherited the base node. I changed the inheritance to node2d and everything worked fine