Home / Tips / WebGL Memory: Log memory values on the browser

WebGL Memory: Log memory values on the browser

/
/
/
671 Views

Hey,

I’m exporting my current project to Unity WebGL and having some issues with the webgl memory consumption. Something that has been really useful is logging the current used/available webgl memory values directly on the browser console while playing the game.

I thought I would share the way to do it (found out here and with a little tweak found somewhere else):

I’m not very fluent in JavaScript so if you have a better version of this code please do share 🙂

Just place this directly on your project index.html (or a .js file) and call the function logMemory. It will print the webgl memory values on the browser console every 5 seconds.

unity webgl memory log
Log unity webgl memory values on the browser console

In my project the functions are placed inside the unityfunctions.js that I use in my template to hold all unity related functionality.

Happy Coding

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest
  • Reddit

Leave a Comment

Your email address will not be published. Required fields are marked *