Created
October 7, 2015 22:36
-
-
Save metaColin/09076a7904a52ffd2fef to your computer and use it in GitHub Desktop.
A simple Unity Web Plugin
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
<html> | |
<head> | |
<script type='text/javascript' src='https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/jquery.min.js'></script> | |
<script type="text/javascript"> | |
var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"; | |
if (document.location.protocol == 'https:') | |
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-"); | |
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>'); | |
</script> | |
<script type="text/javascript"> | |
var config = { | |
width: 960, | |
height: 600, | |
params: { enableDebugging:"0" } | |
}; | |
var u = new UnityObject2(config); | |
jQuery(function() { | |
var $missingScreen = jQuery("#unityPlayer").find(".missing"); | |
var $brokenScreen = jQuery("#unityPlayer").find(".broken"); | |
$missingScreen.hide(); | |
$brokenScreen.hide(); | |
u.observeProgress(function (progress) { | |
switch(progress.pluginStatus) { | |
case "broken": | |
$brokenScreen.find("a").click(function (e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
u.installPlugin(); | |
return false; | |
}); | |
$brokenScreen.show(); | |
break; | |
case "missing": | |
$missingScreen.find("a").click(function (e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
u.installPlugin(); | |
return false; | |
}); | |
$missingScreen.show(); | |
break; | |
case "installed": | |
$missingScreen.remove(); | |
break; | |
case "first": | |
break; | |
} | |
}); | |
u.initPlugin(jQuery("#unityPlayer")[0], "web_ovar_beta.unity3d"); | |
}); | |
</script> | |
</head> | |
<body> | |
<div class="content"> | |
<div id="unityPlayer"> | |
<div class="missing"> | |
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"> | |
<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /> | |
</a> | |
</div> | |
<div class="broken"> | |
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now! Restart your browser after install."> | |
<img alt="Unity Web Player. Install now! Restart your browser after install." src="http://webplayer.unity3d.com/installation/getunityrestart.png" width="193" height="63" /> | |
</a> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment