# BJS 5.0.37-alpha GUI error

**URL:** <https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821>\
**Category:** Bugs\
**Created:** [August 4, 2021, 11:11pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821 "2021-08-04T23:11:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 4, 2021, 11:11pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/1 "2021-08-04T23:11:41Z")

</div>

Hi guys!  
After switching to BJS5 I’m receiving this error. Not yet elaborated the cause. Maybe someone of the pros could give me some pointers, where to search. I am using `AdvancedDynamicTexture` with some buttons. Nothing fancy. Could this be related to some font loading issue? Sometimes I can see the buttons to be rendered by Times New Roman for a fraction of second and after that the custom font kicks in. However it is working in BJS 4.2.0.  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/1/818086a30579803641e08a1b31dcb01d5aa67862.png)

Thanks!  
R.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [August 5, 2021, 12:45am UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/2 "2021-08-05T00:45:45Z")

</div>

Pinging @Cedric as it seems related to a change moving `getFontOffset` to the engine.

But the change was on 2021/04/30. It seems you have another change leading to call `GUI.Control._GetFontOffset` before the engine is created, as we need `Engine.LastCreatedEngine` to exist (else it throws the error you get)…

Are you able to repro in the Playground?

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 5:32am UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/3 "2021-08-05T05:32:16Z")

</div>

Hello!  
I will try to separate the code and create a PG. The Debug tab in the Inspector is not working for me neither. Unable to get engine in the console. I will keep you posted.

EDIT:  
Inspector issue:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/a/bad4b05d394c31cd7cfe09de1ead42af98c9c7e9.png)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [August 5, 2021, 6:55am UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/4 "2021-08-05T06:55:39Z")

</div>

Yes please, it will be easier with a repro PG.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 1:35pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/5 "2021-08-05T13:35:46Z")

</div>

Hi Cedric!  
Sadly, I couldn’t repro in the PG: [https://playground.babylonjs.com/#E102TL#2](https://playground.babylonjs.com/#E102TL#2)

This is my code which causes issues. To be precise, it is the commented out line, which adds the TextBlock as we already predicted it from the error message that it will be something around something that uses fonts.

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/f/7f5ceda816b58147a4faaaadbff7beb42cce03b1.png)

I’ll try to delete `node_modules` and my `package-lock.json`. maybe there are some wrong artifacts left after upgrading to BJS 5.

EDIT: No luck after cleaning the packages…

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [August 5, 2021, 2:02pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/6 "2021-08-05T14:02:47Z")

</div>

Do you create an engine before creating the gui and adding the control?

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 2:21pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/7 "2021-08-05T14:21:48Z")

</div>

Yes, ofcourse. I have a fully running application and it runs on BJS 4.2.0 as expected. Really weird. I am investigating. I’ll keep you posted.  
Thanks!  
R.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 2:47pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/8 "2021-08-05T14:47:36Z")

</div>

Problem solved, at least for me this way:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/9/39ca1945f6c90ba6695ab91e471476546e81b031.png)

Thanks!  
R.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 5, 2021, 3:38pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/9 "2021-08-05T15:38:28Z")

</div>

This should not even work as you are mixing none compatible versions of dependencies.

Also I notice you have both es6 and UMD version of babylon which creates even more potential weirdness.

I would suggest to stick with @babylonjs/… and use @babylonjs/gui on version 37 ?

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 3:44pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/10 "2021-08-05T15:44:06Z")

</div>

Yes, this is reasonable and mixing stuff is very non professional, but it worked for me and I had already done some working stuff in the legacy version,so I just copied it. Actually I’ve just realized that this will be the issue and I’ve stolen a few minutes of @Cedric 's time just for being lame. And yours as well. Sorry guys and thanks for helping me out!  
R.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [August 5, 2021, 3:46pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/11 "2021-08-05T15:46:18Z")

</div>

No worries 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [August 5, 2021, 3:51pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/12 "2021-08-05T15:51:09Z")

</div>

No worries at all, I love all your demos so it is the least we can do 🙂

About the “none professional part” I guess this is not an issue as long as it works 🙂 but here I am afraid of weird side effects you might have later in your project taking ages to troubleshoot 🙂

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 3:57pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/13 "2021-08-05T15:57:51Z")

</div>

Cedric, if my memory serves me well, you’re the author of the navigation plug in. I am working on real time tracking of employees in a building and your stuff is amazing!! We had an algorithm already written in C# for the Unity version of our app, but it is nothing to yours… Oh man, I added support for moving the employees tag meshes between floors just by creating a suitable navmesh, setting some parameters in a matter of minutes and our crowd agents uses the elevators as well without any extra code! Thank you! And to all who contributed! @sebavan for adding the two question marks yesterday! Trying to be funny… 🖖  
R.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [August 5, 2021, 4:08pm UTC](https://forum.babylonjs.com/t/bjs-5-0-37-alpha-gui-error/22821/14 "2021-08-05T16:08:13Z")

</div>

Thanks! Another one is under heavy construction 👷‍♂️ I finally started to discover the NME and the life beyond the limits of CPU and entered the GPU world… The world of power, black magic and incredible cool stuff! You know I am a thin instances fan boy. Manipulating the instances using the GPU is a whole new level! I enjoy it a lot! Thanks goes to @PirateJC for the YouTube video on thin instances and NME, cool pirate ship dude!  
Take care!
