Jump to content

How to inspect when variables are local?


lagauche
 Share

Recommended Posts

Having more Three.js experience where the general practice is to define your variables globally at the top, I'm getting used to keeping them local when that's all I need (most Babylon.js examples seem to do this), but I'm of course unable to inspect them in the browser console to look at the topology. 

This is a pretty general open-ended question, but mostly I'm wondering what's the best way to still be able to inspect when using local variables? I'm more generally wondering what's the best Babylon.js practices with respect to what I'm asking.

Thanks!

Link to comment
Share on other sites

There's nothing preventing you from using global variables, although it is arguably a better practice to encapsulate variables - javascript hoisting can be a hard thing to find/fix.

If you need to inspect local variables you can break in the code by placing a breakpoint in the developer tools or reference from a global variable and composition. 

BabylonJS team has also provided two very useful tools:

1. The Inspector itself is very useful for seeing what is going on. https://doc.babylonjs.com/how_to/debug_layer
2. Spector.js even more low level down to WebGL (https://spector.babylonjs.com/)  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...