- Home /
Resize webplayer upon window resize
I just cant get this to work. The application itself behaves as if the webplayer has resized, but the max. visble area never gets any bigger than the initial size.
This is my resize Javascript function function SetupUnitySize() { GetWindowSize(); if(wWidth && wHeight) { unityWidth=wWidth-80; if(unityWidth<950) unityWidth=950; unityHeight=parseInt(unityWidth*0.667,10); if(unityHeight>wHeight-100) unityHeight=wHeight-100; if(unityHeight<630) unityHeight=630;
var obj = document.getElementById("content");
if(obj) {
obj.style.height=unityHeight+"px";
obj.style.width=unityWidth+"px";
}
obj = document.getElementById("unityPlayer");
if(obj) {
obj.style.height=unityHeight+"px";
obj.style.width=unityWidth+"px";
}
// from here is where I tried all sorts of stuff.
var unity = unitObject;
Output("unity:"+unity);
if(unity != null) {
Output("got unity");
unity.width = unityWidth;
unity.height = unityHeight;
}
if(u) {
Output("got u");
u.width = unityWidth;
u.height = unityHeight;
}
UnityObject2.instances[0].width=unityWidth;
UnityObject2.instances[0].height=unityHeight;
}
}
And this is the html part: lol. ok never mind the HTML part, because i cant seem to prevent it from being interpreted as real html. It is the default html from the unity html templates
This is what you see after resizing. The green border is the div with id "unityPlayer" that gets properly resized. the weird thing is that the application behaves as if the unity element got properly resized (i can click in the invisible areas and the application does what it should do) but the visible area just stays the same.
You can resize it to a smaller size. That works fine. Just not to anything bigger than the initial size.
Your answer
Follow this Question
Related Questions
Web Player SendMessage Array Parameters 1 Answer
How to detect when user clicks to install the webplayer? 0 Answers
Web player my missing HTML is not working 1 Answer
External call to a method not on the WebPlayer.html 1 Answer
How to pass variables to my WEBapp through the html provided after building the app? 1 Answer