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
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
Use Application.OpenURL. For the clicking part, that depends on what you're doing exactly, but using OnMouseDown is one pretty simple way.
I have a short video on how to do this here
Open URL
public void OpenURLYouTube()
{
Application.OpenURL("paste your URL link in here");
}
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
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");
}
}
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
I Use This Simply Code
//Code Start Here
using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine.UI;
public class linkClick : MonoBehaviour {
public void linkFunc()
{
Application.OpenURL ("https://www.desijugads.com/");
}
}
,i will give a feel free answer guys
realy use this code
//code start here
using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine.UI;
public class linkClick : MonoBehaviour {
public void linkFunc()
{
Application.OpenURL ("https://www.google.com/");
}
}