Created
July 7, 2013 23:41
-
-
Save Chronojam/5945398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base.initialURL = "about:blank"; | |
base.Start(); | |
CreateJSObject("App"); | |
SetJSObjectProperty("App", "unityVersion", new JSValue(Application.unityVersion)); | |
SetJSObjectProperty("App", "unityPlatform", new JSValue(Application.platform.ToString())); | |
SetJSObjectProperty("App", "insideEditor", new JSValue(Application.isEditor)); | |
BindJSObjectCallback("App", "quit", OnQuitPressed); | |
LoadHTML(@" | |
<html> | |
<body style='font-family: Helvetica, Arial, sans-serif;'> | |
<h1>Awesomium Rocks!</h1> | |
<p>This web-page was loaded with HTML directly from within Unity3D.</p> | |
<h2>Environment Info</h2> | |
<dl> | |
<dt>Unity Version</dt><dd id='stat1'></dd> | |
<dt>Unity Platform</dt><dd id='stat2'></dd> | |
<dt>Inside Editor?</dt><dd id='stat3'></dd> | |
</dl> | |
<script type='text/javascript'> | |
document.getElementById('stat1').innerText = App.unityVersion; | |
document.getElementById('stat2').innerText = App.unityPlatform; | |
document.getElementById('stat3').innerText = App.insideEditor; | |
</script> | |
<p>The above info was passed to the web-page via a shared JS object.</p> | |
<h2>Callback Example</h2> | |
<input type='button' value='Quit App' onclick='App.quit()' /> | |
<p>The above button is hooked up to a Unity script via a shared JS callback.</p> | |
</body> | |
</html> | |
"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment