Upgrading to 4.0, couple of regressions

Hello. I’d like to update my project to use babylonjs 4.0. To test it, I’ve replaced my current version (3.1.1 via a babylon.custom.js bundle) with the following CDN scripts:

<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
<script src="https://cdn.babylonjs.com/gui/babylon.gui.min.js"></script>

This mostly just works out of the box, with two notable regressions. One is that the advanced dynamic textures in-scene no longer work (the fullscreen overlay still works) and I’m no longer getting onPointerUpObservable events. I’m impressed that there are so few regressions on a major version bump, and I was wondering if anyone had see these issues / knew how to update a codebase to work with 4.x?

Oh, and is there a new way to download a bundle like you could back in 3.x? I often develop without internet access, so a CDN is less than idea. I guess I could just save the files off of the CDN though…

yes :slight_smile:

Can you repro your issues in the playground? (You can pick the version you want on the top right)

It’ll be hard to slice out just the right functionality from a decent sized codebase, but I’ll try.

Is there a way to use the GUI library in a playground?

If you mean the Babylon GUI then definitely yes it is built into the playground.

This is as far as I got:
https://playground.babylonjs.com/#P6JSEC
The tutorials reference it as BABYLON.GUI, is it actually somewhere else? I’m seeing the same issue when I try to go to version 3.3 (I was previously using a babylon.custom.js, but that option looks to be depricated)

There are lots of examples in these docs for using the GUI.

https://doc.babylonjs.com/how_to/gui

Also, the editor for the playground has intellisense, (ctrl + spacebar). If you do that after typing BABYLON.GUI. you can see what’s accessible.

Here’s a minimal example of the mouse up/down issue: try it in 3.3 and the square turns red only when you hold the mouse down, in 4.0.3 the box remains red because no up event fires.

3.3: Babylon.js Playground
4.0.3: Babylon.js Playground

I’ll try and set up an example of the other issue too.

Gotcha! It was a change introduced by 4.0:
https://playground.babylonjs.com/#NQUPP3#1

You just need to tell the system that your rect must block events (and not let them go to the scene where they will be capture) with rect.isPointerBlocker = true;

That works great, thanks for the help! The other issue may be a bit more involved, once I get more context I’ll make a new thread for it if I can’t solve it myself.

1 Like