Cross-Platform Input

How best to handle differences between Input when publishing a game cross-platform? I am trying to handle input from an Xbox 360 controller, but the buttons and axes are handled so differently from OS to OS that it seems unmanageable. And I can’t seem to find an easy way to swap out the InputManager depending on the current platform. Any thoughts?

I’m dealing with this for my app right now.

so far i have a playerController.cs class and use #IF UNITY_ANDROID or #IF UNITY_STANDALONE

these are compiler statements and will block out code from being compiled to these systems.

I dont have any good examples but you could develop a controller class that has the functionality you need and then write separate controls for Playstation and XBOX. That is just an idea.

I know there are controller settings built into unity that are meant to help with this kind of thing. maybe you should do some more searching online as someone has surely come up with an answer better then mine. :slight_smile:

here is something Control Freak 1.1.0 for Unity - Make your game cross-platform in minutes! - YouTube

or you could buy an asset → Unity Asset Store - The Best Assets for Game Making $10 bucks. i wouldn’t pay it myself. but if you are struggling maybe it is an answer for you.

heres one for $30 Unity Asset Store - The Best Assets for Game Making looks nicer.

Thanks! I guess I was hoping I wouldn’t have to have code filled with a bunch of compiler macros, but I guess that’s just the way it’s done?

So it seems like these addons are circumventing the default InputManager altogether? I’ll do some digging into these and keep my eyes out for something else too…if possible I’d like to still use the InputManager Unity provides, as it hooks up easily with the UI system and all that jazz…

I wrote some c# code to manage xbox controllers across multiple platforms. I think it does exactly what you’re looking for. Try it out and contribute if you can improve it!