Running a weblink from inside my game

how can I launch the default web browser and point to a certain URL when an action is performed in the game?

For example, you enter a trigger and it launches the default browser and visits a predefined website.

Try like this.

Note: I’ve tested it only on Windows

using UnityEngine;
using System;
using System.Diagnostics;

...

    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 100, 100), "Go to this link"))
        {
            Process p = new Process();
            p.StartInfo.FileName = "http://www.unity3d.com";
            p.StartInfo.Arguments = "";
            p.StartInfo.UseShellExecute = true;
            p.StartInfo.RedirectStandardOutput = false;
            p.Start();
        }
    }

Can you kindly provide me with the Javascript version of this?

The JavaScript version is almost exactly the same. Swap “void” for “function”, remove all the "using statements, and remove any “new” keywords.

yes, but this line is still giving an error:
Process p = new Process();

I tried using:
var p : Process;
and
var p : System.Diagnostics.Process;

but the error is:
NullReferenceException: Object reference not set to an instance of an object
playvideo.Update ()

As DallonF said, you also need to remove new keyword.

I am not too good in javascript, but I think it’s this way:

   function OnGUI() 
    { 
        if (GUI.Button(Rect(0, 0, 100, 100), "Go to this link")) 
        { 
            var p = System.Diagnostics.Process(); 
            p.StartInfo.FileName = "http://www.unity3d.com"; 
            p.StartInfo.Arguments = ""; 
            p.StartInfo.UseShellExecute = true; 
            p.StartInfo.RedirectStandardOutput = false; 
            p.Start(); 
        } 
    }

Ok, it is working now. But only from an executable. How can I make it run from the web browser version?

I may be wrong, but this is not allowed due security issues, because with Process class you could run external executables from webplayer

But, check this out:

Also, for more power:

and similar functions