07-12-2012, 09:52 PM
Ciao scusa la tarda risposta:
dove sto leggendo io un utente manda questo codice che gli da questi errori:
From various alert()s in the code, I can verify that ResizeUnity() is being called when I change the size of the window. I can verify that winWidth and winHeight are getting proper values assigned to them upon resizing. But, no matter what I do to the browser window, the Unity WebPlayer object stays the same size it was when it was loaded.
quindi un utente gli manda quel script che ti ho dato prima:
It seems the GetUnity() function wasn't grabbing an element high enough up its div hierarchy for me to resize the correct element. Updating my ResizeUnity() function with this did the trick(codice sopra)
ps: questo script è per ridimensionare il player quindi penso che lo puoi fare delle misure che ti servono.
dove sto leggendo io un utente manda questo codice che gli da questi errori:
From various alert()s in the code, I can verify that ResizeUnity() is being called when I change the size of the window. I can verify that winWidth and winHeight are getting proper values assigned to them upon resizing. But, no matter what I do to the browser window, the Unity WebPlayer object stays the same size it was when it was loaded.
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--
function GetUnity()
{
if (typeof unityObject != "undefined")
{
return unityObject.getObjectById("unityPlayer");
}
return null;
}
function ResizeUnity()
{
//This function properly assigns innerWidth and Height to winWidth and winHeight
GetWindowSize();
var unity = GetUnity();
if(unity != null)
{
//This does not properly resize anything at all
unity.width = winWidth;
unity.height = winHeight;
}
}
}
if (typeof unityObject != "undefined")
{
GetWindowSize();
unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", winWidth, winHeight, params);
}
-->
</script>
<style type="text/css">
<!--
div#unityPlayer {
cursor: default;
height: 100%;
width: 100%;
}
-->
</style>
</head>
<body margin="0" marginwidth="0" marginheight="0" scroll="no" onResize="ResizeUnity()">
<div class="content">
<div id="unityPlayer">
<div class="missing">
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
</a>
</div>
</div>
</div>
</body>
</html>
quindi un utente gli manda quel script che ti ho dato prima:
It seems the GetUnity() function wasn't grabbing an element high enough up its div hierarchy for me to resize the correct element. Updating my ResizeUnity() function with this did the trick(codice sopra)
ps: questo script è per ridimensionare il player quindi penso che lo puoi fare delle misure che ti servono.