Hey there, as our scenes get more complicated and load other scenes we are running into a problem with puzzles that are still looking for and events on other scenes, even when they have been unloaded. As an example, if the parent scene has an object that has a hover state and onclick event there are two event listeners. If you add another scene that has its own object with a click and hover state, the puzzles are added to the parent scene, creating a total of four eventListners, two of which are active but do not have any purpose. Now imagine having your parent scene with 1000s of event listners and the second scene has 1000s of listeners…thats alot of wasted cycles. Is there a way to have verge ignore the eventlistners that do not pertain to the active scene.
We are currently writing code to do this so we don’t run into memory issues but was hoping some tools might be coming in a future version that would allow us to manage this process?
Summary:
Problem:
DOM Events registered by puzzles are currently anonymous via initObjectPicking. When eventListeners are registered via click events puzzles, then subsequently those objects are unloaded, those dom object events remain firing which throw console errors:
`
Uncaught TypeError: Cannot read property ‘type’ of null
at Cs.setFromCamera (v3d.js:1)
at HTMLCanvasElement.pickListener (visual_logic.js:583)
`
Expected:
Option 1) As scenes ( gltf ) files are unloaded, inspects occur and remove event listener puzzles for given unloaded objects
Option 2) A hover or click event has a “register” and “unregister” process to manage these events manually or