- Home /
Question by
lucspinto · Nov 14, 2020 at 05:24 PM ·
editorinputeditor-scriptingprogrammingeditorwindow
How to detect if project is Using new or Old Input System via code?
Guys, I need to check the value of this parameter via code. I've tried UnityEditor.PlayerSettings but didn't find anything.
I need this value to know how to handle the Input via code.
imagem-2020-11-14-141815.png
(23.7 kB)
Comment
Best Answer
Answer by diego-giacomelli · Nov 14, 2020 at 06:02 PM
There are two preprocessor directives you can use: ENABLE_INPUT_SYSTEM
and ENABLE_LEGACY_INPUT_MANAGER
:
#if ENABLE_INPUT_SYSTEM
// New input system backends are enabled.
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
// Old input backends are enabled.
#endif
// NOTE: Both can be true at the same time as it is possible to select "Both"
// under "Active Input Handling".
More info: Migrating from the old input system