Tuesday, 11 March 2014

Simple iframe for Unity Webplayer (with instructions and download)

I made an easy way to embed Unity games into websites. Download link: https://dl.dropboxusercontent.com/u/85819592/Unity/SimpleFullFillTemplate.zip
(Extract the WebPlayerTemplates folder into your project's assets folder and select the template at Edit->Project Settings->Player)

To use it with iframe, put this into your html / php's <body>:

<iframe height="95%" src="your_webplayer_url/webplayer.html" width="100%" ></iframe>

Also works with any CMS. In some situation, you should modify the height to a fixed value in your webplayer html and in the iframe too. If you want to get rid of the default iframe border, use this attribute: frameBorder="0"

The following example is sized to 700px high. The reason is just because it is embedded at an other site where this size was set.