Jump to content

Can't import babylonjs-gui?


yzthr
 Share

Recommended Posts

13 hours ago, ssaket said:

If you import it as "GUI" then use GUI.Control not BABYLON.GUI.Control; otherwise use import { separate classes } form 'babylonjs-gui'
or just import 'babylonjs-gui' which will install them in the global BABYLON module and you can use them as BABYLON.GUI

 

 

Yes, u're right. but "addControl" is also undefined.

Link to comment
Share on other sites

23 hours ago, JohnK said:

Really need to see the full code again to see what you have changed

Hi, i have already post the screenshot of the function "createGUI", after that i just call the function once to create the GUI. Sorry for not posting the code cauz the code has not  been finished yet. I think it's a bug.:unsure:

Link to comment
Share on other sites

31 minutes ago, yzthr said:

Hi, i have already post the screenshot of the function "createGUI", after that i just call the function once to create the GUI. Sorry for not posting the code cauz the code has not  been finished yet. I think it's a bug.:unsure:

And what if the error is not in that function? From what @aWeirdo says it is likely to be in the section where you create the advancedTexture. It is always really difficult to help with only part of the picture.

Link to comment
Share on other sites

I agree with aWeirdo and JonhK, it seems, that you reference advancedTexture however it is not defined(there is no instance of the advanced texture) in the function, and it is being referenced locally so if it was defined outside the function it would be in the wrong scope.  

Here is a playground i threw together: https://www.babylonjs-playground.com/#SNE6BN

 

If this doesnt help try recreating your code in a playground like the one above.

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...