First Person Controller Not Working in Editor When Switched to iOS Build Mode

Hi there,

When I switch my project to iOS build, my First Person Character controller stops responding to keyboard and mouse inputs in the editor. This means that prototyping the project and building it for iOS requires switching target builds and reimporting all of the assets (a time consuming pain in the butt). Any thoughts about how to retain FPC functionality in Editor with in iOS build mode? Thanks in advance! :slight_smile:

Okay, figured it out. FirstPersonController.cs references CrossPlatformInputManager.cs. This CrossPlatformInputManager script controls the inputs gets sent to FPC under various build types. In the constructor function static CrossPlatformInputManager(), there are two types of inputs - Mobile and Standalone. If you want the FPC to work with keyboard and mouse in the editor with a mobile target platform, just change activeInput = s_TouchInput to activeInput = s_HardwareInput under the #if MOBILE_INPUT statement. Then change it back when you are ready to build.

1 Like

Thank you so much !!
Your comment is really helpful
Many thanks

Also you can just change the compile flag code to:

#if MOBILE_INPUT && !UNITY_EDITOR
            activeInput = s_TouchInput;
#else
            activeInput = s_HardwareInput;
#endif

so that you donโ€™t use touch input if playing from the editor.

Yes!! That works great. I was getting really tired of forgetting to change the code after a build. Thanks!

That work great, thanks @hungrybelome