x


How do you get webplayer 3.1 to go full window?

I need the html wrapper for the web player to let the player go 'full window' (not full screen mind you). That is, I want it to fill the div/frame/window of whatever it's sitting in.

I tried putting '100%' in where ever I could see (but not in the .js file). This got me as far as it going full-width, but the height is always about 400 pixels.

What's the best way of accomplishing this?

more ▼

asked Feb 04 '11 at 09:03 PM

DaveA gravatar image

DaveA
26.5k 151 171 256

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

try this

add margin: 0px 0px to the body style and div.content style

add this code to the script GetUnity():

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' )
  {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  }
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  }
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  unityObject.embedUnity("unityPlayer", "MyAwesomGame.unity3d", myWidth , myHeight);

that may be more than you need but it works for me. When the page loads, it will set the game resolution to the current window size, so if they resize the window, it stays the same. If you want that to stretch to fit dynamically, that's something else.

more ▼

answered Feb 04 '11 at 11:01 PM

Art 1 gravatar image

Art 1
147 2 3 10

...looking for that stretch, that would be nice...

Feb 04 '11 at 11:46 PM DaveA
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x810
x72
x8

asked: Feb 04 '11 at 09:03 PM

Seen: 858 times

Last Updated: Feb 04 '11 at 09:03 PM