Whether the Inspector Metadata function can be enabled as needed?

For some reason, I encapsulate the Babylonjs object, and then let its metadata point to the source object. After 6.2, the Inspector can display metadata, which will cause stack overflow.for example,

class Box{
  constructor(){
     this.intance=null
  }
  init(){
       const box=MeshBuilder.CreateBox();
       this.intance=box;
       box.metadata={entity:this}
  }
}

Hello,

I tried your class example in the PG but no stack overflow ocurred Test metadata recursive | Babylon.js Playground (babylonjs.com), can you give a playground example?

1 Like
babylon.inspector.bundle.max.js:46810 Uncaught RangeError: Maximum call stack size exceeded
    at babylon.inspector.bundle.max.js:46810:1
    at Array.every (<anonymous>)
    at MetadataGridComponent.objectCanSafelyStringify (babylon.inspector.bundle.max.js:46810:1)
    at babylon.inspector.bundle.max.js:46810:1
    at Array.every (<anonymous>)
    at MetadataGridComponent.objectCanSafelyStringify (babylon.inspector.bundle.max.js:46810:1)
    at babylon.inspector.bundle.max.js:46810:1
    at Array.every (<anonymous>)
    at MetadataGridComponent.objectCanSafelyStringify (babylon.inspector.bundle.max.js:46810:1)
    at babylon.inspector.bundle.max.js:46810:1

sorry i can’t revert on PG, my local error is infinite recursion on this function.

image

Do you mean the error only happens locally, not on PG?

Yes, I can’t restore on PG, and I don’t know how to debug Inspector code on PG.

@ZoeLeee your metadata are creating a loop which should probably not be the case

I temporarily fixed this by making the relevant properties non-enumerable