Log in or register to post comments

Open url when touch an Game object.

May 14, 2013 - 8:15pm #5

Hello!

I'm trying to open an URL(facebook/twitter) with simple touch in the Game object. I used:
function OnMouseDown(){
     Application.OpenURL ("www.facebook.com");
}

That script work perfectly in unity Play mode, but when I execute the app in my Samsung Tablet, it crashes.

I hope to somebody can help me!
Thanks
 

Open url when touch an Game object.

May 14, 2013 - 10:33pm #4

Hi, this does not sound like an issue with Vufora, but more like a general Unity programming issue

Have you searched for this in some Unity specialized forums ? 

 

 

Open url when touch an Game object.

June 5, 2013 - 4:27pm #3

Hi,

The method won´t get called on an Android or iOS device since no mouse exists.

You have to try the Raycast + Collider approach.

Open url when touch an Game object.

June 5, 2013 - 5:11pm #2

That's right. You can retain the OnMouseDown handler and use SendMessage w/ RayCasting. There's an example at the beginning of this thread - https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/how-add-touch-listener-3d-object-unity

Open url when touch an Game object.

June 6, 2013 - 12:53pm #1

I haven't had any problems using onmousedown(0) on android.

 

If you use a guitexture as the button there's an easy method to determine whether it's being pressed using .HitTest(Input.mousePosition) or touch.position

 

 

  1. for (var touch : Touch in Input.touches)
  2. if (mybutton.guiTexture.HitTest (touch.position)){
  3. // we are now in the guitexture
  4. Debug.Log("Touch");
  5. }
  6. }
Log in or register to post comments