Unity Web Player - Error when loading for the first time


I’ve recently started developing with Unity and have run into an issue.

I built the game that I’m working on for the Unity Web Player; when I first try to play the game in my browser I see the Unity loading bar as normal but when loading is finished the web player screen starts flashing vey fast and sometimes shows pieces of graphics from other parts of the screen while flashing (it looks as though something goes wrong with the video memory), sometimes it shows pieces of graphics that were on screen fairly recently but not anymore. You can tell that the game is playing as it should because you can hear the sounds but you can’t see anything apart from mad flashing. When I refresh the page everything works as it should. If I then leave it for a while and come back to it and load the page again the flashing will be back (until I refresh again). I have tried this on Safari, Chrome and Firefox and they all act the same. I have also tried on a different computer (although they were both running osx).

I have another game that I recently built that works perfectly well. I can’t think of anything that I have done differently, they are both very simple games.

Does anyone have any idea what the problem could be caused by? I don’t even know where to begin.

You can see my game here: http://joshua_burr.itch.io/swarm-attack (name suggestions very welcome), hopefully you will see the effect that I’m talking about (I tried opening the unity-built html file to play the game locally and have seen the same effect so it is nothing to do with itch).

Here are a couple of screenshots of the kind of stuff I see while it is flashing:


I have fixed this now. The problem was a script that I had on my camera:

void Awake()
    Camera.main.orthographicSize = Screen.height / 200f;

Changing this to:

void Start()
    Camera.main.orthographicSize = Screen.height / 200f;

fixed my problem.

I also noticed that you get the same effect if you build a scene with no camera.