Is there a define for controller or keyboard input?

I’m just wondering if there is a #if to check if the user is using a keyboard or controller? I can’t seem to find anything myself.

Not that I know of, there’s this list of what works for unity. These type of preprocessors are meant for stripping out unrelated code for a particular platform. Not really sure why you’d want to target specific inputs with them. Wouldn’t you just let the player decide what to use?


Defines cannot check anything on the user platform at runtime. For that use a regular if statement.

Defines can only check knowledge available at compile time. So you can strip the keyboard code out of your iPhone build. You can strip the touch screen code out of your PC build. You cannot make changes based on if your PC user is using the mouse or a joystick.

Unless you want to release a joystick version of your game and a mouse version. That’s just plain bad marketing.