# Is this bug. Or am I doing anything wrong?

**URL:** <https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559>\
**Category:** Questions\
**Created:** [April 13, 2019, 5:42pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559 "2019-04-13T17:42:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_Sheehan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ian_sheehan/32/1195_2.png) [@Ian\_Sheehan](https://forum.babylonjs.com/u/Ian_Sheehan)\
**Post date:** [April 13, 2019, 5:42pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/1 "2019-04-13T17:42:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nasimiasl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nasimiasl/32/34_2.png) [@nasimiasl](https://forum.babylonjs.com/u/nasimiasl)\
**Post date:** [April 13, 2019, 5:48pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/2 "2019-04-13T17:48:06Z")

</div>

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();  
});

---

<div class="post-metadata">

**Author:** ![Ian\_Sheehan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ian_sheehan/32/1195_2.png) [@Ian\_Sheehan](https://forum.babylonjs.com/u/Ian_Sheehan)\
**Post date:** [April 13, 2019, 6:06pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/3 "2019-04-13T18:06:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 13, 2019, 6:07pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/4 "2019-04-13T18:07:02Z")

</div>

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:)

---

<div class="post-metadata">

**Author:** ![Ian\_Sheehan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ian_sheehan/32/1195_2.png) [@Ian\_Sheehan](https://forum.babylonjs.com/u/Ian_Sheehan)\
**Post date:** [April 14, 2019, 5:34am UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/5 "2019-04-14T05:34:51Z")

</div>

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](https://playground.babylonjs.com/#5JQL8I)

Greetings

@Deltakosh  
@nasimiasl

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 14, 2019, 3:53pm UTC](https://forum.babylonjs.com/t/is-this-bug-or-am-i-doing-anything-wrong/2559/6 "2019-04-14T15:53:13Z")

</div>

Here is your fix:  
[https://playground.babylonjs.com/#5JQL8I#1](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
