Bug with Babylon.GUI.XmlLoader and numbers in TextBlock

I have found a bug that occurs when using the XmlLoader. If I have a TextBlock.text that has a number in my gui XML I get an error because the TextBlock.text is the number 2018 and not the string “2018”

textblock.ts line 394 - the crash is becuase this.text is 2018 and not “2018”

    var _lines = this.text.split("\n");

textBlock.ts:394 Uncaught TypeError: this.text.split is not a function
at TextBlock…/2D/controls/textBlock.ts.TextBlock._breakLines (textBlock.ts:394)
at TextBlock…/2D/controls/textBlock.ts.TextBlock._processMeasures (textBlock.ts:283)
at TextBlock…/2D/controls/control.ts.Control._layout (control.ts:1417)
at Button…/2D/controls/container.ts.Container._layout (container.ts:332)
at StackPanel…/2D/controls/container.ts.Container._layout (container.ts:332)
at StackPanel…/2D/controls/container.ts.Container._layout (container.ts:332)
at StackPanel…/2D/controls/container.ts.Container._layout (container.ts:332)
at Container…/2D/controls/container.ts.Container._layout (container.ts:332)
at AdvancedDynamicTexture…/2D/advancedDynamicTexture.ts.AdvancedDynamicTexture._render (advancedDynamicTexture.ts:630)
at AdvancedDynamicTexture…/2D/advancedDynamicTexture.ts.AdvancedDynamicTexture._checkUpdate (advancedDynamicTexture.ts:611)
./2D/controls/textBlock.ts.TextBlock._breakLines @ textBlock.ts:394
./2D/controls/textBlock.ts.TextBlock._processMeasures @ textBlock.ts:283
./2D/controls/control.ts.Control._layout @ control.ts:1417
./2D/controls/container.ts.Container._layout @ container.ts:332
./2D/controls/container.ts.Container._layout @ container.ts:332
./2D/controls/container.ts.Container._layout @ container.ts:332
./2D/controls/container.ts.Container._layout @ container.ts:332
./2D/controls/container.ts.Container._layout @ container.ts:332
./2D/advancedDynamicTexture.ts.AdvancedDynamicTexture._render @ advancedDynamicTexture.ts:630
./2D/advancedDynamicTexture.ts.AdvancedDynamicTexture._checkUpdate @ advancedDynamicTexture.ts:611
(anonymous) @ advancedDynamicTexture.ts:350
e.notifyObservers @ babylon.js:16
t._renderForCamera @ babylon.js:16
t._processSubCameras @ babylon.js:16
t.render @ babylon.js:16
(anonymous) @ gallery.js:141
t._renderFrame @ babylon.js:16
t._renderLoop @ babylon.js:16
requestAnimationFrame (async)
e.QueueNewFrame @ babylon.js:16
e._queueNewFrame @ babylon.js:16
e.runRenderLoop @ babylon.js:16
constructor @ gallery.js:136
Promise.then (async)
(anonymous) @ gallery.js:134

ping @msDestiny14

Hey there,

This is an issue with the Babylon.GUI ( pinging @Deltakosh who did it) rather than with the xml loader. Just convert the number to a string and it should work just fine.

If there is something needed loader side let me know.

I’ll fix that!

3 Likes