Set URL as clickable in Lable string

Hi all,

How can we achieve this? I’ve a string with urls lets say “something http://www.google.com again http://www.amazon.com” or “http://www.google.com nexturl http://www.amazon.com”. Now what I want is, when I am showing this string (in a UILabel), I could make the link clickable, i.e., the link should act like a url, so that when I click it, it should open me the respective link.

Please provide me your suggestions on how to achieve this. Also I am using NGUI for showing labels.

Thanks in advance.

EDIT : Found this on NGUI Forum, this is related to my ques but no help :
[Make Links in string clickable][1]
[1]: Make Links in string clickable
:frowning:

Detect button click normally like one always do in NGUI and then us Application.OpenURL to open the url:

private void OnClick()
{
    Application.OpenURL(url);
}

I can think of two different approaches

· Limit the URL size, with the default options of “size” or just adjusting the .text variable of that UILabel to do whatever you want. For example: when the size of a URL exceeds 30 characters, replace the last characters for “(…)”

· Put only one UILabel, it will have the entire text + URL. Over it, there will be an invisible button the size of the URL. You will have to position this invisible button exactly on the top of URL. To me, this seems a bit more “dirty”, but if this is only for an isolated case and not meant to be reused in the rest of the project, it may work for you.