• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by fjam100 · Nov 27, 2010 at 01:20 AM · mouseobjectsurllinkput

How do I put a link to a website when I click with the mouse an object or word?

Thanks to "UnityWebPlayer" the game can be played from your browser. But I would like to put a link to a website when clicking on objects (Images, doors, words ...) Would it be possible to put a url when I click with the mouse?

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

6 Replies

· Add your reply
  • Sort: 
avatar image
8
Best Answer

Answer by Eric5h5 · Nov 27, 2010 at 02:11 AM

Use Application.OpenURL. For the clicking part, that depends on what you're doing exactly, but using OnMouseDown is one pretty simple way.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fjam100 · Nov 27, 2010 at 02:29 AM 0
Share

Thanks, I'm interested in this code, but do not know how to put in the code "OnMouseDown"

avatar image fjam100 · Nov 27, 2010 at 02:50 AM 0
Share

I think I have it.

Thank you very much has been helpful

avatar image
1
Best Answer

Answer by oliver-jones · Nov 27, 2010 at 01:21 AM

You can find that info on here: file:///Applications/Unity/Documentation/ScriptReference/WWW.html

But you do this:

// Get the latest webcam shot from outside "Friday's" in Times Square var url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg"; function Start () { // Start a download of the given URL var www : WWW = new WWW (url);

 // Wait for download to complete
 yield www;

 // assign texture
 renderer.material.mainTexture = www.texture; 

}

This is example taken from Unity, showing you to retrieve info from websites. But you can manipulate into URL

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fjam100 · Nov 27, 2010 at 01:32 AM 0
Share

Thank you very much for answering

I see the picture but I do not know where to put the web address in the code.

avatar image oliver-jones · Nov 27, 2010 at 01:40 AM 0
Share

Where the var url is, change that in the "http://" to your specific website

avatar image fjam100 · Nov 27, 2010 at 02:32 AM 0
Share

Thank you very much

avatar image
0

Answer by rafaelzuckerberg · Apr 02, 2016 at 04:57 AM

you can do so: create one function:

// function of the button public void exampleFunction(string link){ Application.OpenURL (link); }

or :

// function of the button public void exampleFunction(){ Application.OpenURL ("www.exemplo.com"); }

now pass as parameter in your button or choose not pass parameter

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mafanbong8819 · May 05, 2017 at 01:50 PM

Here, is the example of how to click the button then link to url, the step is clearly listed in this video. I hope this video is helpful to those need it too.

Click here for video, video - button to link

Here is the code.

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;

public class linkClick : MonoBehaviour {

 public void linkFunc()
 {
     Application.OpenURL ("http://www.google.com");
 }

}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by prefix · Oct 13, 2017 at 02:47 PM

I have a short video on how to do this here Open URL

 public void OpenURLYouTube()
 {
     Application.OpenURL("paste your URL link in here");
 }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Can I place a link (such as ) into the GUI.Label? 4 Answers

link that point to objects 1 Answer

Select/Drag/Drop Objects with a mouse 0 Answers

Dynamic link url and text in WebGL build 2 Answers

Button Link Page web 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges