Author Topic: Onclick URL to a sprite in a scrollview  (Read 2254 times)

eormo

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 6
    • View Profile
Onclick URL to a sprite in a scrollview
« 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 :)
« Last Edit: March 30, 2016, 12:19:55 PM by eormo »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Onclick URL to a sprite in a scrollview
« Reply #1 on: March 31, 2016, 04:02:38 AM »
OnMouseDown is a Unity event. NGUI's equivalent is OnPress(bool isPressed), or OnClick().