Touch Image?

Random discussions.

Touch Image?

Postby adrian » Fri Jan 06, 2017 1:02 am

Is it possible to use TouchScript on UI images in Unity 5?

Try as I may, I cannot get a touch to register on an image!

- I added a circle collider to the image
- I added a Press Gesture
- I added Camera Layer 2D to camera
- I added a Touch Visualizer to the scene
- I added a TouchScript/Touch Manager prefab

I created and added the following script to the image but pressed function never gets called:

using System;
using UnityEngine;
using TouchScript.Gestures;
using TouchScript.Behaviors;

namespace Touch.Examples
{
public class TouchSprite : MonoBehaviour
{
private PressGesture press;

private void OnEnable()
{
press = GetComponent<PressGesture> ();
press.Pressed += Pressed;
}

private void OnDisable()
{
press.Pressed -= Pressed;
}

public void Pressed(object sender, EventArgs e)
{
Debug.Log ("why does this not work????");
}
}
}

Thanks
adrian
 
Posts: 4
Joined: Thu Jan 05, 2017 9:16 pm

Re: Touch Image?

Postby adrian » Fri Jan 06, 2017 1:26 am

Never mind. I missed the bit about removing the default EventSystem and adding UI Layer.

Thanks
adrian
 
Posts: 4
Joined: Thu Jan 05, 2017 9:16 pm

Re: Touch Image?

Postby valyard » Tue Jan 10, 2017 12:51 pm

Can you try the 9.0 version?
It is much easier to work with UI in the new version.
https://github.com/TouchScript/TouchScr ... /9.0alpha2
valyard
Site Admin
 
Posts: 422
Joined: Mon Sep 08, 2014 11:57 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests