I am using UIElements like TextBlock and Button imported from “@babylonjs/gui” for building an info panel inside the babylon scene. I have added ‘fontSize’ as a percentage and set ‘resizeToFit’ to true to make the TextBlock responsive to page resizing.
Everything works fine when run locally but I am seeing CSP errors when running the deployed version.
I am trying to remove inline styling and move all the style definitions to a .scss file. After importing the scss file how can I apply it to the babylon components. I see a ‘getClassName’ but there is no way to set the className.
The babylon GUI is not HTML, so CSS will not help you at all. it’s a simplified (or “DOMified” ) way of creating gui using known css definitions. Not sure the CSP is because of that. What error do you actually get?
Have you checked the example I provided?
The Babylon GUI is not HTML. Hence it is styled a little differently. You can set the font type, the font style, the font size and so on. Check the example and follow the code there
Sorry - as @sebavan said - a reproduction would be great. If it is used in an external project (which I assume it is) - would you be able to share the project and the way you build it?
I use on a private project and I never have seen this error.
Therefore we still have to migrate to the newer version, we are still using the latest 4 version.