Hello,
When dynamically creating interactable meshes and adding a ActionManager.onPointerOutTrigger without a matching ActionManager.OnPointerOverTrigger, results in an “Uncaught RangeError: Maximum call stack size exceeded” error.
In most cases you would want to register both triggers for interaction feedback, but the behavior seems like a bug because it only happens in certain situations.
To reproduce, delay for a random time or wait for user interaction. Then add a mesh to the scene and register an ActionManager.onPointerOutTrigger. Do not register an ActionManager.onPointerOverTrigger. Some time must pass after the scene is created and the cursor must be over the canvas when the trigger is registered.
When the mouse moves off the mesh, you will get a bunch of “Uncaught RangeError: Maximum call stack size exceeded” errors.
If both an ActionManager.onPointerOutTrigger and ActionManager.onPointerOverTrigger are registered, no errors.
If the ActionManager.onPointerOutTrigger is registered without the ActionManager.onPointerOverTrigger when the scene is created, no errors.
If the mouse is not over the canvas when the ActionManager.onPointerOutTrigger is registered, no errors.
Here’s a playgound.
Simple GUI in fullscreen mode | Babylon.js Playground
Loading the playground and keeping the mouse out of the canvas, no errors.
Loading the playground with the mouse over the canvas when the trigger is registered, open the dev console and behold the errors.
On lines 38 and 39 you can see:
const addOverTrigger = false;
var createInstantly = false;
Set any of the addOverTigger or createInstantly variables to true, no errors.