- Home /
Generic input in Unity 3.0
Hi, I have found generic input function in Unity which would be the same for all mobile devices including Androids platforms. How about the Mouse Input for PC? I have tried Touch function in PC and it doesn't seems to be working.. How can I make the PC Mouse Input to be the same as iPhone and Android so I don't have to rewrite the input handling code for all devices..
Answer by Dreamora 1 · Oct 07, 2010 at 04:47 AM
you can't you will have to use the mouse if you are on desktop and the touch if you are on mobiles.
touch and mouse just are elementally different, mapping them to the same would not only be troublesome but basically completely incorrect.
the opposite would work, thats why you can get the first touches data through the mouse command but who would want to trash multitouch for lazyness if you can use the platform precompiler directives / conditional compiling to implement distinct code handlings for desktop and mobile which also only get compiled and included when on the right platform :)
I found iPhone to $$anonymous$$ouse Input C# script which might be useful for testing on window if I Can replace that iPhoneInput with Generic Input (Unity 3.0)... How can I know whether we are testing and building for iPhone or Windows? Does the unity has any #ifdef flags something like
ifdef iPhone
endif
ifdef PC
endif
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Does Unity have a way of storing and comparing the last key pressed with the current one. 1 Answer
How to distinguish between multiple keyboards? 1 Answer
Input.mouse position on GUI Textures 2 Answers
Tilting the Player Object while moving it with Input.acceleration 0 Answers