Is this bug. Or am I doing anything wrong?

I am using BabylonJS GUI api,

When I init engine and scene.
And than do
var scene = new BABYLON.Scene(self._engine);
var freeCamera = new BABYLON.FreeCamera(‘FreeCamera’, new BABYLON.Vector3(0, 5, -10), scene);
freeCamera.setTarget(BABYLON.Vector3.Zero());
freeCamera.attachControl(canvas, false);
dialog = new MyDialog(engine);
let advancedTexture = MyDialog.init();

engine.runRenderLoop(() => {
scene.render();
});

I get this console msg (as something is wrong with…
engine.runRenderLoop and scene.render()

BJS - [19:34:20]: Layout cycle detected in GUI (Container name=StackPanel1, uniqueId=17)

Did anybody report similar issue…
Is this Bug or Am I doing something wrong ?

@Deltakosh

Greetings

function createScene(engine){

var scene = new BABYLON.Scene(self._engine);
var freeCamera = new BABYLON.FreeCamera(‘FreeCamera’, new BABYLON.Vector3(0, 5, -10), scene);
freeCamera.setTarget(BABYLON.Vector3.Zero());
freeCamera.attachControl(canvas, false);
dialog = new MyDialog(engine);
let advancedTexture = MyDialog.init();

}

createScene(engine);

// try use this out of create scene
engine.runRenderLoop(() => {
scene.render();
});

I’ll try and let you know it this will be ok

Hey! Can you repro in the playground or share your gui code?

There is a layout cycle (meaning something that forces the layout to keep updating infinitely). For instance this could happen when a container tries to compute its size based on content but the content is using percentage so it also depends on the container size:)

Hi Deltakosh
Here is repro on playground with msg in console (F12 you will see)

babylon.js:16 BJS - [07:32:26]: Layout cycle detected in GUI (Container name=StackPanel1, uniqueId=757)

https://playground.babylonjs.com/#5JQL8I

Greetings

@Deltakosh
@nasimiasl

Here is your fix:
https://playground.babylonjs.com/#5JQL8I#1

Anything inside a vertical stackpanel cannot have values in percentage. So I fixed it by settings the paddingTop and paddingBottom to sizes in pixel

1 Like