Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Illya Kuryakin · Oct 30, 2010 at 07:27 PM · webplayerwindowfullscreenhtml

Unity 3.0 Webplayer at 100%

I have run into a problem when I change the 800 and 600 to 100%. It does not properly size the window to full screen. Instead I get a squashed screen.

html code:

unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", 800, 600, params);

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image spencer lindsay · Dec 03, 2010 at 10:04 PM 0
Share

I just asked this in a different way as well.

7 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Chriz · Mar 11, 2011 at 03:45 PM

My solution to this problem was to use a small piece of javascript to find the dimentions of the webpag, before creating the unity object, then using thes values as the height and width.

Chriz.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

     Unity Web Player | WebPlayer
     
     
     

if (typeof unityObject != "undefined") { return unityObject.getObjectById("unityPlayer"); } return null; } if (typeof unityObject != "undefined") {

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

     var params = {
     backgroundcolor: "000000",
     bordercolor: "000000",
     textcolor: "FFFFFF",
     //logoimage: "MyLogo.png",
     //progressbarimage: "MyProgressBar.png",
     //progressframeimage: "MyProgressFrame.png"
     disableContextMenu: true
     };
     unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", myWidth, myHeight, params);

 }
 --&gt;
 &lt;/script&gt;
 &lt;style type="text/css"&gt;
 &lt;!--
 body {
     font-family: Helvetica, Verdana, Arial, sans-serif;
     background-color: black;
     color: white;
     text-align: center;
 }
 a:link, a:visited {
     color: #000;
 }
 a:active, a:hover {
     color: #666;
 }
 p.header {
     font-size: small;
 }
 p.header span {
     font-weight: bold;
 }
 p.footer {
     font-size: x-small;
 }
 div.content {
     margin: auto;
     width: 100%;
 }
 div.missing {
     margin: auto;
     position: relative;
     top: 50%;
     width: 193px;
 }
 div.missing a {
     height: 63px;
     position: relative;
     top: -31px;
 }
 div.missing img {
     border-width: 0px;
 }
 div#unityPlayer {
     cursor: default;
     height: 100%;
     width:  100%;
 }
 --&gt;
 &lt;/style&gt;

</head> <body> <!-- <p class="header"><span>Unity Web Player | </span>WebPlayer</p> --> <div class="content"> <div id="unityPlayer"> <div class="missing"> <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"> <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /> </a> </div> </div> </div> <!-- <p class="footer">&laquo; created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> &raquo;</p> --> </body>

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tomekkie2 · Jan 08, 2012 at 12:38 PM 0
Share

That is good, but lacks an event handler to serve the browser window resizing event. I am going to make my own embedding template comprising a bottom div strip of 100% width and some 120px height and the WebPlayer on the top of the page; 100% width, the rest of the heigh. This could be good starting point for that.

avatar image tomekkie2 · Feb 23, 2012 at 05:57 PM 0
Share

Have been fighting with that quite a bit, added the resize handlers and finally put my findings into the form of blog post: http://virtualplayground.d2.pl/WP/?p=367 Welcome to test, download and use if like.

avatar image
2

Answer by Illya Kuryakin · Dec 07, 2010 at 03:27 PM

Hi Spencer,

Yeah it is very hard to get information about the new 3.0 Unity html format I had to go to Wikileaks to get some help (Actually I got some help from some cool Unity guys at Unite 2010)

I have finally got something that works. Attached is my template that I am using for full-screen publishing. It also is set up to customize the player load screen to use custom art and turn off the right-click menu pop-up.

(Replace the WebPlayer.unity3d with your file and you should be good to go)

Have a Merry Christmas - html in your stocking :-) ),

Illya


            };
        unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", "100%", "100%", params);
        }
    -->
    </script>
    <style type="text/css">
    <!--
    body {
        position:fixed;
        font-family: Helvetica, Verdana, Arial, sans-serif;
        background-color: white;
        color: black;
        text-align: center;
    }
    a:link, a:visited {
        color: #000;
    }
    a:active, a:hover {
        color: #666;
    }
    p.header {
        font-size: small;
    }
    p.header span {
        font-weight: bold;
    }
    p.footer {
        font-size: x-small;
    }
    div.content {
        margin: auto;
        width: 640px;
    }
    div.missing {
        margin: auto;
        position: relative;
        top: 50%;
        width: 193px;
    }
    div.missing a {
        height: 63px;
        position: relative;
        top: -31px;
    }
    div.missing img {
        border-width: 0px;
    }
    div#unityPlayer {
        position:fixed;
        cursor: default;
        height: 480px;
        width: 640px;
    }
    -->
    </style>
</head>
<body>
    <div class="content">
        <div id="unityPlayer">
            <div class="missing">
                <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
                    <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
                </a>
            </div>
        </div>
    </div>
    <p class="footer">&laquo; created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> &raquo;</p>
</body>

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bigkahuna · Dec 11, 2010 at 11:32 AM 1
Share

Could you post the entire .html file? I tried a cut and paste into the default template that Unity creates and it didn't work.

avatar image
1

Answer by Ryan Deluz · Apr 22, 2011 at 06:24 PM

I had to change the tag to:

<body marginheight="0" topmargin="0" vspace="0" marginwidth="0" leftmargin="0" hspace="0" style="margin:0; padding:0">

To get rid of a slight border

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by spencer lindsay · Dec 03, 2010 at 03:44 AM

Hi Illya,

I'm having a tough time sizing my player to 100% as well. The guys over at Hello Racer (http://www.helloracer.com/) did it but looking at the code, it's a different type of embed.

Is there a parameter that we can pass to UnityObject.js that will play full screen?

Replacing X and Y with 100% just breaks it.

Alas, I am but an artist and codeage makes my head pop.

Thanks for any pointers.

-Spence

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Illya Kuryakin · Dec 12, 2010 at 04:01 PM

Sorry guys - I kept trying to post the whole thing but I think the answer section was actually using it to format (and chop) this post... btw - the top section was so you could customize your web player (replace art and Piano.unity3d with your goodies) - Happy Holidays - Illya


<!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" src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js"></script> <script type="text/javascript"> <!-- function GetUnity() { if (typeof unityObject != "undefined") { return unityObject.getObjectById("unityPlayer"); } return null; } if (typeof unityObject != "undefined") { var params = { backgroundcolor: "000000", bordercolor: "000000", logoimage: "Technical_Designs_Splash.png", progressbarimage: "Technical_Designs_ProgressBar.png", progressframeimage: "Technical_Designs_ProgressFrame.png", disableContextMenu: true

             };
         unityObject.embedUnity("unityPlayer", "Piano.unity3d", "100%", "100%", params);
         }
     --&gt;
     &lt;/script&gt;
     &lt;style type="text/css"&gt;
     &lt;!--
     body {
 position:fixed;
 font-family: Helvetica, Verdana, Arial, sans-serif;
 background-color: #000000;
 color: black;
 text-align: center;
     }
     a:link, a:visited {
         color: #000;
     }
     a:active, a:hover {
         color: #666;
     }
     p.header {
         font-size: small;
     }
     p.header span {
         font-weight: bold;
     }
     p.footer {
         font-size: x-small;
     }
     div.content {
         margin: auto;
         width: 640px;
     }
     div.missing {
         margin: auto;
         position: relative;
         top: 50%;
         width: 193px;
     }
     div.missing a {
         height: 63px;
         position: relative;
         top: -31px;
     }
     div.missing img {
         border-width: 0px;
     }
     div#unityPlayer {
         position:fixed;
         cursor: default;
         height: 480px;
         width: 640px;
     }
     --&gt;
     &lt;/style&gt;
 &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;&lt;/head&gt;
 &lt;body&gt;
     &lt;div class="content"&gt;
         &lt;div id="unityPlayer"&gt;
             &lt;div class="missing"&gt;
                 &lt;a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"&gt;
                     &lt;img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /&gt;
                 &lt;/a&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
     &lt;p class="footer"&gt;&amp;nbsp;&lt;/p&gt;

</body> </html>

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bigkahuna · Dec 13, 2010 at 12:43 AM 0
Share

Awesome stuff, works perfectly. Thanks very much!

avatar image pretender · Feb 23, 2012 at 05:09 PM 0
Share

works great!

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mac Standalone fullscreen window menu options customization 0 Answers

custom webplayer not building project 0 Answers

webplayer resolution problems/issues/oddities and frame rate weirdness 6 Answers

External call to a method not on the WebPlayer.html 1 Answer

Mouse input offset problem in web fullscreen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges