Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update control.ts #15116

Merged
merged 1 commit into from
May 20, 2024
Merged

Update control.ts #15116

merged 1 commit into from
May 20, 2024

Conversation

Debenben
Copy link
Contributor

fix Uncaught TypeError: Cannot read properties of undefined (reading 'getScene')

When trying to use BabylonJS version 7.6.0 or later I get a crash, I believe this proposed change should fix it, if there is more to it let me know and I can share the complete setup to reproduce the crash.

fix Uncaught TypeError: Cannot read properties of undefined (reading 'getScene')
@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2024

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented May 19, 2024

Visualization tests for WebGPU (Experimental)
Important - these might fail sporadically. This is an optional test.

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15116/merge/testResults/webgpuplaywright/index.html

@deltakosh
Copy link
Contributor

How do you repro the issue?

I have no problem with that fix but curious to see how it can happen

@Debenben
Copy link
Contributor Author

The crash can be reproduced like this:

    var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("ui");
    var control = new BABYLON.GUI.TextBlock("control");
    var panel1 = new BABYLON.GUI.StackPanel("panel1");
    panel1.addControl(control);
    advancedTexture.addControl(panel1);
    var panel2 = new BABYLON.GUI.StackPanel("panel2");
    //panel1 is added to texture, but not panel2
    panel2.addControl(control); // <-- crashes here

In my code I needed to rearrange controls in a stackpanel. There are probably better ways to do this, but at the time I used a temporary stack panel here:
https://github.com/Debenben/babyele/blob/master/src/guimodeselection.ts#L206

@deltakosh deltakosh merged commit e504365 into BabylonJS:master May 20, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants