Log in or register to post comments

OnMouseDown on Android leading to weird behaviour

January 19, 2015 - 8:03am #1

Hi !

 

I've been using Vuforia for quite a few apps during the next months and it worked fine, great job ;)

Yet, i'm facing a strange problem.

Scene :

- I have a few 3D models (containe dinto one gameobject) that are appearing when the tracker is detected.

- One of this object is some sort of "Point of interest" dot. On this dot is attached a monobehaviour script with a OnMouseDown event, that wille display an illustration on GUI when triggered.

 

Scenario :

- I start the app and target my tracker.

- My 3D models appear, including my dot.

- If i touch the screen anywhere but on the dot, nothing happens, as expected.

- If i touch the dot, my illustration appears, as expected, along with a cross icon to close the illustration.

- If i touch the cross icon, the illustration disappears.

- Now, if i toucht he screen anywhere, it will trigger the mouse event of my dot, even though i'm not touching the dot itself !

 

Basically, the first time i display the illustraiton, everything works as expected, and then, touch event goes crazy.

 

I tried the same thing without any vuforia stuff and it works great. Any idea why Vuforia is triggering my dot when it shouldn't ?

 

 

-----

 

P.S The dot code is very simple and is as follow :

using UnityEngine;
using System.Collections;

public class POIGUI : MonoBehaviour 
{
	public Texture2D	m_texToDisplay;

	void Start () 
	{
		if (m_texToDisplay == null)
		{
			Debug.Log("POIGUI.cs (Start) : Invalid parameters on " + this.gameObject.name + ", this script will be useless and therefore, disabled.");
			this.enabled = false;
		}
	}

	void OnMouseDown() 
	{
		GUIImage.setTexture(m_texToDisplay); //Define what illustration our static class should display
		GUIImage.displayTexture(true); //Set our static class to display the illustration and the cross icon
	}
}

 

Log in or register to post comments