BJS 5.0.37-alpha GUI error

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

Thanks!
R.

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?

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

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

Hi Cedric!
Sadly, I couldn’t repro in the PG: 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

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…

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

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.

Problem solved, at least for me this way:
image

Thanks!
R.

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 ?

2 Likes

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.

1 Like

No worries :slight_smile:

1 Like

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

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

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… :vulcan_salute:
R.

2 Likes

Thanks! Another one is under heavy construction :construction_worker_man: 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!

2 Likes