And Half A Fish Games.

And Half A Fish

Reaching for the Stars. Aug 10, 2014 - Q & A : Web Player build.

Q : Why is my spotlight not working in the Web Player build ?

A : Well. There is a setting in the Unity editor that is very easy to overlook. It is hiding in this location : Edit > Project Settings > Quality.

Web Player : spotlight not working.

You have to click the downward arrow next to 'Default', in the column of the Web Player.
I have changed the default setting to 'Good' and set the 'Pixel Light Count' to 3.

Q : How do I incorporate the Web Player build into my website ?

A : The easiest thing to do, is just copy all files inside the generated 'web' folder into your project. Next, copy the contents of the 'web.html' file into your own web page.

Building & incorporating into my website.
If you want, you can keep these files in a subfolder, as long as you take care to change the paths! One thing I wanted to do, but have not been able to figure out yet, is how to also put the web.unity3d file into that subfolder ...

Q : How do I disable resizing of the game on the web page ?

A : You do this by chosing the right template when you build your game : 'File' > 'Build Settings' > 'Player Settings' > 'Resolution & Presentation' :

Disabling the context menu.
This option ('Something Context Men' ... - According to the official documentation, it is supposed to read 'No Context Menu' ???) disables right-clicking on the Unity plugin. So, no resizing (no full screen).

But. You can still zoom the web page (Ctrl +), & that really messes up labels & buttons ...

So, to fix this : use your good old friend 'GUI.matrix'.
I found a really clean & easy way to do this on the site of Ben Silvis :

public static void AutoResize(int screenWidthDesign, int screenHeightDesign) {
    Vector2 resizeRatio = new Vector2(  (float)Screen.width / screenWidthDesign, 
                                        (float)Screen.height / screenHeightDesign   );
    GUI.matrix = Matrix4x4.TRS(, Quaternion.identity, new Vector3(resizeRatio.x, resizeRatio.y, 1.0f));

void OnGUI() {
    AutoResize(450, 600); // size used during design of game
    // the rest of your code

Q : Optimizing the build ?

A : Something interesting : when you import an image into the Unity editor, you will see 2 dropdown buttons. One says 'Max Size', the other one 'Format'.

Optimizing textures.

'Format' has the options : 'compressed', '16 bits', and 'truecolor'.
The Unity documentation says that you can change the format to something that is 'not compressed' to work faster in the editor. But. Unity will still compress your textures when it builds !

To optimize your build, you should zoom in (scene view) & play with the 'max size' settings. You should lower the settings until you start seeing fuzziness. Then go one setting back up.