Jump to content

TypeError: BABYLON.GUI.GUIImage is not a constructor


Vorion
 Share

Recommended Posts

Hi,

I wanted to try the latest preview release, but my IDE says that "Image" does not exist on type "typeof GUI". By looking at the available types from the GUI, the IDE suggests GUIImage, so I replaced everything with GUIImage.

Now I get a console error in my browser, saying "TypeError: BABYLON.GUI.GUIImage is not a constructor".

I get the same error on the playground, which btw also suggests GUIImage.

By looking at the source code, I think this was intentional, but it isn't mentioned in the what's new file for the preview release.

You can see the error on the playground https://www.babylonjs-playground.com/#K60448#22

Is this a bug, or do I need to change something else to get it working?

Thanks.

Link to comment
Share on other sites

I just upgraded to the latest version and encountered this issue as well.

 

The problem is that the class is defined as GUIImage in the .d.ts now for some reason, while the actual js still defines the class as Image.

I simply changed it manually in the .d.ts for now, but I suppose it should be fixed.

https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/gui/babylon.gui.d.ts

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...