A game about forced loneliness, made by TACStudios
1---
2uid: input-system-use-in-editor
3---
4# Using Input in the Editor
5
6Unlike Unity's old Input Manager, you can use the new Input System from within `EditorWindow` code as well. For example, you can gain access to pen pressure information like this:
7
8```CSharp
9class MyEditorWindow : EditorWindow
10{
11 public void OnGUI()
12 {
13 var pen = Pen.current;
14 if (pen != null)
15 {
16 var position = pen.position.ReadValue();
17 var pressure = pen.pressure.ReadValue();
18
19 //...
20 }
21 }
22}
23```
24
25This encompasses all code called from `OnGUI()` methods, which means that you can also use the Input System in property drawers, Inspectors, and other similar places.
26
27>__Note__: Unity doesn't support Actions in Edit mode.
28
29## Coordinate System
30
31The coordinate system differs between `EditorWindow` code and `UnityEngine.Screen`. `EditorWindow` code has its origin in the upper-left corner, with Y down. `UnityEngine.Screen` has it in the bottom-left corner, with Y up.
32
33The Input System compensates for that by automatically converting coordinates depending on whether you call it from your application or from Editor code. In other words, calling `Mouse.current.position.ReadValue()` from inside `EditorWindow` code returns mouse coordinates in Editor UI coordinates (Y down), and reading the position elsewhere returns it in application screen coordinates (Y up).
34
35Internally, an editor-specific Processor called `AutoWindowSpace` handles this translation.