Introducing "Input.Touches", a low cost, easy to use helper library for Unity3 touch (and mouse) input.
Input.Touches uses event system to signal various input event. Letting you focus on dealing with your actual code instead of juggling with various input.
- Supported input event:
- single finger: short tap, long tap, multi-tap, charge(timed-pressed), drag, swipe
- multi-finger: short tap, long tap, multi-tap, charge(timed-pressed), drag.
- special gesture: pinch, rotate
- Support concurrent input (2 or more input type at the same time) for most events. The exception are multi-finger drag, pinch and rotate.
- Uses event system, keep things simple.
- Support both JS and C#.
- Tested and works on PC and iOS device.
- Various example scene with documented code in both JS and C#.
- Compatible and supported by Playmaker.
- Comes with support of a dedicated developer.
Feel free to try out the demo. Please visit here for more information.
Input.Touches is now available on AssetStore, link here. Feel free to comment or pm me if you have any question.
* Please note that you will need some scripting knowledge to use this library.
* Please note that this framework only works on hardware that is supported by unity by default.
Last edited by songtan; 05-30-2013 at 04:56 PM. Reason: updates
Just another shameless bump now that the package is now live on AssetStore. Thanks again for reading.
So, is this a code-once solution? I'm looking for something easy to use, that doesn't require me to re-write or juggle input schemes between platforms (PC/Mac vs. iOS). It also has to support JS and be well-documented (as you've already stated, just calling it out).
The biggest thing you've never heard of.
This should work just fine switching from PC to Mac to device. I myself does that quite often and I understand it's quite a pain trying to maintain input code for build across all platforms.
I dont have an extensive example of js but I do include a simple demonstration of how to use the event system using js. I think I have a rather comprehensive documentation and example code. But I'm happy to take any feedback and make the necessary amendment. You can be sure that customer satisfaction is my first concern.
This solution supports multi-touch operation of Windows7?
Question, is multi-touch possible in the flash player?
@milkhall, This framework uses only unity default touch input functionality. As far as I know it does not support multi-touch on window7. So the answer is no.
@Shawn, The framework is very much device and system dependant. If the input device is supported by unity, then yes. Pardon me but I'm not sure what device and system you are refering to. My understand is flash player are not available on iOS device, which this framework is developed and tested on. I imagine it should work just fine on an android device. However if you other desktop based touch input device, then unfortunately the answer is no.
Would the code works across iOS, Android, and PC (Unity Simulator)?
@HeyGuys, Yes, it should be able to do just that.
Hi. The RTS camera demo in your package does not work as well as the web demo. When I move camera with right mouse button, the camera only moves slightly, while on the web demo it works perfectly. I tried to increase panSpeedModifier to 1000, still no luck.
@abbc, I dont seem to have that problem, both on my window pc and mac. Can you please let me know platform are you running on? It would help tremendously if you could just sent me your package so I can take a closer look.
I think I know what caused the problem. I imported your package into the Procedual example project.
When I create a new project, import your package as usual, and the problem disappears.
I am using Windows 7 by the way.
I've just bought this, tried on Windows and Android. Curently, there is no problem for me. The RTSdemo just worked out of the box. The only problem with the RTSdemo is that the camera does not rotate around the "target" object, instead it rotates around its parent. Therefore the "target" slot is a bit confusing, since it's not used at all.
Anyway, thanks for this simple and effective tool.... very well worth the price.
Last edited by rextr09; 05-24-2012 at 11:40 PM.
Thanks for the feedback regarding the RTSdemo. I'll make sure that I remedy that in the next update.
Appreciate the kind words you put in.
This looks useful. Just bought it. Hope to try it out soon!
None of the complicated taps seem to be working. I'm using the latest version of unity. I open your tap demo scene, and the only one in there that seems to work is the drag one. Is there anything else I need to do to get them to work?
@Grooms, I have pm you. Could you plase respond so I can help you to sort out the issue. Thanks.
I had the same issue, it seems things got commented out (the whole code for detecting in editor).
Easy fix though:
In TapDetector.cs in line 115 remove the "//" so that
#if (!UNITY_IPHONE && !UNITY_ANDROID) //|| UNITY_EDITOR
#if (!UNITY_IPHONE && !UNITY_ANDROID) || UNITY_EDITOR
I just realized that SwipeDetector.cs has the same issue. Just change line 132 the same way.
Changing SwipeDetector.cs the way I described f*cks up the SwipeDetector-Demo completely. It says it always detects a swipe as soon as you click somewhere in the editor. The sphere moves erratically when moving the mouse while fire1 is held down.
Added "&& (!UNITY_EDITOR)" in line 46 in TapDetector.cs and line 75 in SwipeDetector.cs and now it's working fine.
Hope that helps
Last edited by delstrega; 05-27-2012 at 05:21 AM.
@delstrega, Thanks alot for the elaborate modification. I really appreaciate it. The issue where some of the input are not working are cuased by the target platform selection. The mouse Input wouldnt work properly when the target platform is set to iOS or Andriod.
I'm quite aware of this. The lines of code such as
- #if (!UNITY_IPHONE && !UNITY_ANDROID) || UNITY_EDITOR
- #if UNITY_IPHONE || UNITY_ANDROID
are there to prevent mouse and touch input to be detected simultaneously. The reason is unity would detech mouse input as a finger touch and vive versa. However the detection of touch input as mouse would only applied if the target platform is set to iOS. Without this platform depandant compilation, the mouse input detection would mess up the touch input when running on device.
By default, those purposefully coded restriction prevent mouse input to work when the platform is set to mobile. The reason I made it so is that I would expect developer to be more keen on testing their mobile build via touch using device or Unity Remote. delstrega's is a vaible solution which would enable mouse input to work when the platform is set to iOS or android, however in doing so the touch input can only tested when running on a device, which of course prevent the usage of unity remote.
TLDR: The default code will only allow touch input but not mouse input in mobile platform. Hope this clear up the issue.
I see now, so that's why you did it this way. Since I don't use Unity Remote that much, I hadn't actually noticed that it wouldn't work correctly the way I "fixed" the scripts. But to be honest, it was kinda odd seeing the provided examples not working in the editor using mouse input.
Thanks for the clarification!
EDIT: I thought the dragging in TapDemo was kinda strange too (in Editor) so I played around with the code some more. Here's the fix for that:
General.cs line 17: add "&& (!UNITY_EDITOR)" and the dragging works fine.
(Mind songtan's previous post though!)
Last edited by delstrega; 05-27-2012 at 06:19 AM.