TouchScript and uGui (Unity 4.6)

Got a good idea for TouchScript? Post it here.

Re: TouchScript and uGui (Unity 4.6)

Postby noamg » Mon Mar 30, 2015 4:18 pm

Whenever I have a panel that I want to make sure that it blocks touchscript, I put a Selectable component in its root (then when a click registers there, that will be the selected game object because it is in front of the touch catcher etc).
This way I can even have certain uGUI elements not block TouchScript (becuase they don't have a selectable in their hierarchy) etc.

I agree that there isn't a "one size fits all" solution yet, its all a matter of understanding your game's UX usecase and deriving a workflow from it.
noamg
 
Posts: 15
Joined: Wed Nov 26, 2014 1:12 pm

Re: TouchScript and uGui (Unity 4.6)

Postby valyard » Wed May 13, 2015 12:54 am

Guys, as a part of UI effort I added this TouchScriptInputModule (https://github.com/TouchScript/TouchScr ... tModule.cs) to an experimental branch. Don't mind the branch... yet.

Can any of you using other InputModules compatible with TouchScript try and replace them with this one and see if it works?
It is a combination of TouchInputModule and StandaloneInput module which routes TouchScript input to Unity UI.
Put it to your EventSystem game object and make sure that no other InputModules exist.

2015-05-13 00-53-53 InputModule.unity - TouchScript - PC, Mac & Linux Standalone.png
2015-05-13 00-53-53 InputModule.unity - TouchScript - PC, Mac & Linux Standalone.png (73.9 KiB) Viewed 3012 times
valyard
Site Admin
 
Posts: 435
Joined: Mon Sep 08, 2014 11:57 pm

Re: TouchScript and uGui (Unity 4.6)

Postby senc01a » Fri May 22, 2015 2:25 pm

Hi Valyard,
So far this solution is working for me.
I can indeed interact with UI elements via a touch input, TUIO in particular.

In addition I tried to add a TapGesture to one of the UI components (also with a collider, etc), but that didn't work. I don't even think that is necessary, but I just wanted to let you know.
Thanks for your amazing work.

Regards,
Javier.
senc01a
 
Posts: 2
Joined: Fri May 22, 2015 10:51 am

Re: TouchScript and uGui (Unity 4.6)

Postby valyard » Sat May 23, 2015 10:41 am

Right, this solution won't work with gestures.
You will need another script I made to do this. I'll release it as a part of version 7.
valyard
Site Admin
 
Posts: 435
Joined: Mon Sep 08, 2014 11:57 pm

Re: TouchScript and uGui (Unity 4.6)

Postby djandrew » Wed May 27, 2015 8:22 pm

So will you be able to use both at the same time?

Like for example, a uGUI scrollrect for scrolling text and then tapgestures on something else for multi-touch support at the same time?

This is the problem I'm having. 95% of my app uses TouchScript, but where we have scrolling text we used uGUI scrollrects, but they don't work together.
djandrew
 
Posts: 9
Joined: Thu Oct 30, 2014 1:04 am

Re: TouchScript and uGui (Unity 4.6)

Postby valyard » Sat May 30, 2015 4:45 pm

> So will you be able to use both at the same time?

This will need some experimenting.
The input layer in 7.x works with GraphicRaycaster and you can tap on buttons. Probably you could write a script which redirects touchscript touch input to scrolling.
I need to try that.
valyard
Site Admin
 
Posts: 435
Joined: Mon Sep 08, 2014 11:57 pm

Re: TouchScript and uGui (Unity 4.6)

Postby djandrew » Mon Jun 01, 2015 6:51 pm

It's now working for me, both with multi-touch on win 7 and uGUI elements like scrollrects at the same time with the TouchScriptInputModule. Thanks!

http://touchprefab.com/viewtopic.php?f=1&t=24301
djandrew
 
Posts: 9
Joined: Thu Oct 30, 2014 1:04 am

Re: TouchScript and uGui (Unity 4.6)

Postby Podden » Sun Jul 19, 2015 11:42 pm

Just updated, works fine, even if I already put in the TouchScriptInputModule. But if I understand correctly, I still have to block Touches from going through the UI myself?
I'm currently testing every touch with RectTransformUtility.RectangleContainsScreenPoint to stop them from doing things through the GUI. Or is there already a solution for that?
Podden
 
Posts: 10
Joined: Thu May 07, 2015 5:21 pm

Re: TouchScript and uGui (Unity 4.6)

Postby valyard » Sun Jul 19, 2015 11:47 pm

Podden, do you mean that you if you have an UI button over a touchable 3d element, right?
TouchScriptInputModule doesn't work with gestures at all, it just injects touches to UI input system. If you have gestures and touch layers, right now you need to do something manually with these touches. I'm working on a convenient mechanism to do this.
valyard
Site Admin
 
Posts: 435
Joined: Mon Sep 08, 2014 11:57 pm

Re: TouchScript and uGui (Unity 4.6)

Postby Podden » Mon Jul 20, 2015 3:34 am

Thanks for the info. Yes my current system has a GUI in front of 2DColliders and the Gestures are reacting throught the GUI.

As a suggestion: You can define the sortinglayer and sortingorder of the UICanvas itself, so why not just treat them like every other sprite inside CameraLayer2D?
Podden
 
Posts: 10
Joined: Thu May 07, 2015 5:21 pm

PreviousNext

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest