Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: eormo on March 28, 2016, 11:46:36 AM

Title: Onclick URL to a sprite in a scrollview
Post by: eormo on March 28, 2016, 11:46:36 AM
Hi,

I have a UI2D sprite in my scrollview that needs to open an URL once triggered with an onclick. Below is the code I generally use but it doesn't seemed to work with NGUI :

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class URL : MonoBehaviour {
  5.  
  6.         void OnMouseDown () {
  7.                 Application.OpenURL("http://mywebsite.com");
  8.         }
  9. }

I've found another topic about this issue on the forum but the solution provided did not work for me...

Thanks for reading!

EDIT : I got it working through the UIButton component :)
Title: Re: Onclick URL to a sprite in a scrollview
Post by: ArenMook on March 31, 2016, 04:02:38 AM
OnMouseDown is a Unity event. NGUI's equivalent is OnPress(bool isPressed), or OnClick().