- Home /
GUI Button that is linked to a HTML page
Hey people
I have a unity webplayer embedded into my website. Is there a way of getting a GUI Button within the unity project to link to a HTML page ?
for example here is the code I have currently
var customGuiStyle : GUIStyle;
function OnGUI () { if (GUI.Button (Rect (27,17,100,25), "Main Menu", customGuiStyle)) { Application.LoadLevel("Main Menu");
}
}
What this code does is load the "Main Menu" level i originally had. Now i have constructed a HTML page which now serves as the main menu.
What I need is for this script to take the user from the unity project to the HTML page engine-main-menu.html.
Is this possible ????
Cheers
Answer by DaveA · Apr 04, 2011 at 03:37 PM
This is probably the most expedient api for you: http://unity3d.com/support/documentation/ScriptReference/Application.ExternalEval.html
You can have it load any page
Answer by efge · Apr 04, 2011 at 03:38 PM
You could use the function OpenURL.
Take also a look at this reference page: Unity Web Player and browser communication
Your answer
