- Home /
WebPlayer embedding question
Is there a way to embedd WebPlayer full browser window, but with leaving a side or bottom strip of constant size? I mean: say 100% width, 100% - 100px height.
I know how do that, using unityObject.embedUnity
But that doesn't accomodate browser window resizing events.
Is there a way to access unityobject.js variables to follow browser window size?
Answer by ByteSheep · Jan 09, 2012 at 01:23 AM
Easiest way would probably be to open the html document that unity has created and find the line:
div#unityPlayer {
cursor: default;
height: 450px;
width: 600px;
}
then change that to something like:
div#unityPlayer {
cursor: default;
height: 90%;
width: 100%;
}
the above will probably make it a set 100% height and 90% width, however if you really want an exact pixel strip along the bottom you could try:
div#unityPlayer {
cursor: default;
height: 100%;
width: 100%;
margin-bottom: 100px;
}
Can't say if this will work for sure, but you should be able to reset the size in the html.
I tried to modify the below layout: http://virtualplayground.d2.pl/Unity/BoundBoxes/boundboxes.html in the manner you suggest, but no success, looks like the percentage embedding values relate to browser window, not the css element. I wanted to get something like this: http://virtualplayground.d2.pl/Unity/ShowHideUploadFS/ but with WebPlayer rescaling on browser rescale.
Hmm, you should be able to see how the other guys webplayer has been embeded. I believe he used javascript..
Have been fighting with that quite a bit and finally put my findings into the form of blog post: http://virtualplayground.d2.pl/WP/?p=367