Cannot read property 'viewport' of undefined

Anybody have idea what could be causing this?? It happens when I try to load the scene.I have no idea where to even start looking.


Hello and welcome!
can you repro the problem in the playground?

hi @Deltakosh, i think it would be too hard to try because my game code is in several long :smiley: classes. Everything worked fine until now but I think I found the culprit. It seems this happens when I try to load dummy3.babylon file with asset manager.

how is it possible that loading a mesh causes error inside gui code? i found what causes it but have no idea how to fix it

This should work with no problem
This is why I would love a repro :slight_smile:

I tried to reproduce it in playground, but there everything works fine. I can provide link to my repository if you would like to take a look. I managed to load a file with SceneLoader. But with AssetManager no luck.

Well unfortunately no. If it works in the pg then it is likely something in your code.
This is why we try to always get a repro in a neutral environment like the playground

You might get a clearer idea of your problem by using Babylon.js/babylon.gui.js at master · BabylonJS/Babylon.js · GitHub rather than the minified version, this will give you the full name of the o variable for a start and you can see if the entities on line 4692 exist in your code.

1 Like

I came across the same error. For anyone searching the forum for the error message: call GUI.AdvancedDynamicTexture.CreateFullscreenUI() AFTER camera added to the scene

1 Like

I can confirm this fixed my issue when it happened to me ! The problem was my environment wasn’t fully set up and the camera wasn’t created yet. Thanks @zzm3145 and welcome back on the forum ! :smiley:

@Andrija_Perusic If you’re still around, please check if this fixes your issue (and if it does, mark your question as solved !)

1 Like