Skip to content

Instantly share code, notes, and snippets.

@eralpkaraduman
Last active August 29, 2015 14:05
Show Gist options
  • Save eralpkaraduman/b117a45ab79d5ae70641 to your computer and use it in GitHub Desktop.
Save eralpkaraduman/b117a45ab79d5ae70641 to your computer and use it in GitHub Desktop.
Embedding Unity3D in Tumblr & Stuff
// customize theme -> edit html
// paste below in head
<!-- Unity3D -->
<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 unityEmbed = function(selector,file,width,height){
var config = {
width: width,
height: height,
params: { enableDebugging:"0" }
}
var u = new UnityObject2(config);
u.initPlugin(jQuery(selector)[0], file);
}
</script>
<!-- Unity3D end -->
// create new post, paste as html
<div id="ld30unityPlayer">
<div class="missing">
<a href="javascript:unityEmbed('#ld30unityPlayer','https://yoursite.com/unityFile.unity3d',640,480);">
PLAY NOW, NEEDS UNITY PLAYER
</a>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment