- Home /
How to resize webplayer depending on user resolu
I'm making a "2d" game in Unity and I'm implementing facebook. I'm almost finished, but the issue is lower resolution monitors can't see the entire game. I'd like to know if there's a way to zoom out (like ctrl + -) when their resolution is too low.
Can't you actually do this with Javascript alone ? Or perhaps HT$$anonymous$$L, and use %'s as width .
I looked into that, but the issue is if I make the webplayer bigger, it changes the size of the camera view as well, which means things are spread out more in the scene and causes issues with gameplay.
Ah! Ouch. I did not know that the camera view changes when resized. That kind of sucks . . . Eh, I will do some searching, and respond if I do find something . . . Perhaps you could contact Unity3D directly on the issue ?
I bet there is a way, but, I have not a clue how to detect the players size in the html document :\
Answer by Graham-Dunnett · Nov 24, 2012 at 10:06 PM
Set the size of the unity object to be a percentage of the page, and as the webpage is resized the web player will resize. You can detect the change in size using the pixelWidth and pixelHeight members of the camera class. Unity will assume it has to render to the whole space available to it. Use pixelRect to restrict rendering to a certain rectangle. If the window is made too small for the game, then don't render anything, and instead display a message saying the window needs to be a certain size for the game to work.
Your answer
Follow this Question
Related Questions
WWW POST request headers gone on webplayer facebook 1 Answer
Unity Web Player in Facebook: How to set the application name ? 1 Answer
Webplayer not recognized in IE and Facebook 1 Answer
Logo image in Facebook Canvas increases loading time. 0 Answers
Will a WebPlayer build that uses the Facebook SDK work when accessed directly on my own server? 0 Answers