Unity Web Player Tips and Tricks

Home  >>  Game Development  >>  Unity Web Player Tips and Tricks

Unity Web Player Tips and Tricks

27
Apr,2015

0

Unity Web Player Tips and Tricks

So are you making unity games for the web player build? Least to say, you have already realized that the development process of web builds is slightly different from the usual Desktop builds and has its own set of pitfalls. So I tried compiling some Unity web player tips and tricks that might help someone else in need:

 

  1. Dynamic Resizeable Unity Web Player
    Most often, you would be deploying your games and want it full screen. That too, resizeable. So, you can basically change the default html’s css to make it full screen. You can  visit THIS link to proceed further. Basically you download a package and it will install custom WebTemplates in your Assets Folder.  Go to Player Settings and choose the custom Template to have Full-screen Dynamic resizeable Unity Web Player.
  2. Web Build Logging
    So during testing in your browser, the first issue you have realized in Web Builds is not able to see any console logs when you are trying to communicate with the browser JavaScript.  The logs are situated at %USERPROFILE%\Local Settings\Temp\UnityWebPlayer\log .  Make sure you are running the web player, and then navigate to the Directory. You may see 2 files – one will start with “log” and another with “manager”. You can open the “log” file to see the current logs, as you would do in console.
    Also, if this all seems a hassle for you, try navigating to THIS link and download this wonderful and free unity asset package. All you need to do is Go to Menu > Reporter > Reporter. This will create a game object on the current scene. And also, Set the execution order (Edit > Project Settings > Script Execution Order), add the Reporter.cs file and set its order to the highest. Thats it. When you run the scene, try to draw a circle (clockwise)  on the screen and kabam, the Reporter will throw useful information at your screen. Also, the navigation bar is scrollable ( if you missed it).

    In Editor Debug Console

    In Editor Debug Console

  3. Browser Communication
    When using C# for Unity (most cases, its C#) if you are trying to define parameters in a method that will be invoked by external javascript from browser, always and always make the type of the parameters as System.Object  as the variable conversion is not very smooth between C# and Javascript. Lateron in your c# code, you can always convert the received parameter data to any type you want.
  4. FREE Publishing
    Okay so, you need to show a quick game to your clients or boss? This is a pretty sleek trick ( and pretty old one imho):

    1. Make a Web Build Target
    2. Register at Dropbox (FREE)
    3. Upload your game files to your account’s public folder
    4. Right click on the html file you just copied and select “Copy Public Link”.
    5. Copy the link and share with your Client or boss
      * You may need to Enable Public Folders manually.
      **  You may want to use Google’s URL shortner to make your shareable Game link “Pretty”.
  5. Optimization for Low Connection Speeds
    Try making multiple Sub unity3D files as a single massive untiy3d file will take forever to load and you don’t want to loose your precious players on the excuse if they are using low connection speed. Use this stupidly easy tool to easily load Assets over internet/external file and many more stuff.
  6. Optimization for Low end Computer Memory
    You must have the experience that almost all of the time, textures take up to 90% of all the space in the final build. As said by many people, always try to have the textures in 128×128 / 256×256 / 512 x 512 .. etc resolutions. Its just the way Unity compresses them more effectively. Also, you need to understand to make balance between Low Quality + Lower Size -AND- High Quality + Higher Size. Ofcourse the choice is not that easy but it will surely come with experience and rigorous game-play testing. Try having a quality manger script that automatically detects the target environment and loads texture assets conditionally (will be updating on the script very soon).
  7. coming soon
    Comment below to let me know if any of the above tips are helpful to you. Will keep adding more and more unity web player tips and tricks …

 

The dropbox trick was shamelessly taken from this wonderful site.

Comments

comments

Leave a Reply