I have a client that requires IE 11 support (and won’t install the web player) so I’m trying to get my Unity game to work as well as possible. It seems possible to get the game to mostly function, but both the frame rate and loading time are pretty sad.
Has anyone else attempted to do this? If so, do you have any advice on optimization for IE 11? Right now I’ve removed some extraneous code, reduced my texture quality, and switched to vertex-lit shaders. This seems to have helped slightly.
Have you tried to profile it to see what’s taking time on CPU ?
If loading times are bad, reducing texture/vertex data might help and if that’s not enough you may want to consider asset bundles so that you download most assets later on in the game when you actually need them.
According to our benchmarks, the performance gap between IE11 and other browsers like chrome and firefox is mostly on the CPU side. I suggest you take a look at it with the Profiler.
When I try the profiler (and manage to not have it crash) there is a lot of time used in “BehaviorUpdate” and “Overhead”. That doesn’t seem to be the case when I profile in the Editor itself. We have tons of polys/verts so Camera.Render is also taking up a lot of time (but that is somewhat expected).
I have found a few machines where the app runs without a problem (with a newer CPU and an inferior graphics card).
For example, we have a machine with these specs:
Intel Core i5-4570, 3.2 GHz, 4 GB RAM, Win 7 Pro 64, Intel HD Graphics 4600
where the app runs at 60+ FPS. We have another machine with an older processor but a far superior graphics card:
Intel Core i7 870, 2.93 GHz, 8 GB RAM, Win 7 Home Premium 64, AMD Radeon HD 7850
where the app only runs at 15 FPS.
Does the CPU alone make that much of a difference? In the past it has seemed that the graphics card was more important, but perhaps that is not true for WebGL builds? Is there some way to offload any of that CPU work to the GPU?
I have tried more moving some more assets into asset bundles and that seems to have helped the loading time a bit (still not great).
I took all all of my scripts and just put some models on the screen.
On the i5-4570 I’m still getting 60FPs, on the i7-870 I’m getting 20FPS. I profiled on both and it seems like Camera.Render is where the biggest difference is on both machines. On the fast machine the average is 7.58ms, on the slow machine it is 23.55ms.
All of my objects are marked static and Batch.DrawStatic seems to be taking the most time on each.
On the same machine that is getting 20FPs in IE11 I get 60FPS in Chrome and Firefox.
It always depends on the content, however, what we have noticed on Unity WebGL is that GPU performance is not much different compared to native applications and this is also true for IE11 according to Benchmarks I ran recently (which we are going to publish soon).
On the CPU, with the exception of scripts execution, Unity WebGL is generally slower than native. IE11, in particular, does not perform well but you can get nice speed up by using Edge instead (2x at the very least), even with asm.js not enabled by default.
For more information about our benchmarks check this old blog post.
Is depends on your project but general-purpose computations cannot be offloaded at the moment.
Yes, that definitely help reducing loading times, but does not solve your performance issues.
I think you are probably bound on CPU by the number of draw calls. In the editor you can take a look at your frame using the frame debugger. That might give some indications about # of draw calls, what’s being batched or not, etc…
Thanks, that frame debugger looks interesting. I will take a look.
There seems to be some sort of fillrate issue (I think) since reducing the size of the app (from say 1024x768 to 800x600) results in a decent FPS boost (maybe 5FPS extra).
It looks like maybe something things aren’t batching that I would (theoretically) like to batch. If objects share the same material and are marked static is there another reason they wouldn’t batch? Perhaps if they have too many verts/tris individually? Does Unity try to keep batches to a certain size?
if the objects were not marked static, there would be a few constraints like number of vertices, etc… but if they are static and share the same material, they should definitely batch.
Thanks again for the feedback. I believe all of the objects are being batched to a degree, I guess I’m just confused as to why there are so many batches (and thus more draw calls). I tried changing all of the materials to the same material and all objects are static and I’m getting 40ish batches (on 650ish objects). Should I get 1 batch in this sample since all objects have the same material and are static? Are there any project settings that could impact this? I tried making a project from scratch but that didn’t seem to change anything.
The machine I was testing on magically now runs at 60 FPS. It looks like it ran some Windows Updates overnight and the next day it was working much better. Unfortunately I’ve tried installing the same updates on another machine and that doesn’t appear to have done anything.
Are there any .NET or Windows updates that would dramatically impact WebGL framerate in IE like that? I’m trying to figure out how to make the same changes to other machines.