- Home /
#if !MOBILE_INPUT usage in example project.
I'm currently studying the standard assets example project, more specifically, the "Character First Person" and throughout the code I've see an lot of "#if !MOBILE_INPUT". Can someone explain to me what this does? I know about #if and all, but I don't see why it's so necessary to just check for no mobile input. Thanks in advance :)
Answer by Xarbrough · Dec 19, 2015 at 05:21 PM
The Standard Assets include a cross-platform input system that makes it possible to use the assets on pcs, consoles and mobile devices alike. The biggest differences are in the mobile input, so the standard assets have a menu option to turn off mobile input entirely, which in turn set a #define to actually exclude relevant mobile input code from compilation. This is just a simple way of doing it. And yea of course they could just use regular if statements to distinguish between different input methods, but stripping out unneeded code during compilation has better performance and is better to keep code bugfree.
Your answer
![](https://koobas.hobune.stream/wayback/20220612053216im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using AirBrakes on mobile device with Standard Assets AircraftController 0 Answers
FPS Controller from unmodified Standard Assets (U5) not working on Android!! 0 Answers
Standard Assets' DualJoysticks not working with Unity Remote 1 Answer
help with First Person mobile game 1 Answer
rotate camera on mobile 1 Answer