Skip to content

Instantly share code, notes, and snippets.

@De-Panther
Last active October 24, 2024 04:31
Show Gist options
  • Save De-Panther/19a036d1b6f8aefb79d8049e24fc1516 to your computer and use it in GitHub Desktop.
Save De-Panther/19a036d1b6f8aefb79d8049e24fc1516 to your computer and use it in GitHub Desktop.
Code snippet for loading SpectorJS in WebGL page. Copy this code to the development console of a web page with WebGL content. Make sure that you are posting it in the right context(if the canvas is inside an iframe).
var newScript = document.createElement("script");
newScript.onload = function() {
var spector = new SPECTOR.Spector();
spector.displayUI();
};
document.head.appendChild(newScript);
newScript.src = "https://spectorcdn.babylonjs.com/spector.bundle.js";
@unphased
Copy link

I think this doesn't work if the page you're attempting to using this on isn't setting appropriate CORS headers.

@De-Panther
Copy link
Author

Sometimes the SpectorJS CDN is down, alternative URL can be https://unpkg.com/spectorjs/dist/spector.bundle.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment