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
0
Question by Orbcreation · Dec 21, 2012 at 07:15 PM · javascriptwebplayerresizehtml

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.

alt text

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


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