I have made a gui layout using the online GUI Editor and saved it as a JSON file for my project. In my script, I simply use the AdvancedDynamicTexture.parseFromURLAsync() method to convert it to UI elements.
On my localhost, the method runs fine, but when deploying it to the server, the script cannot find the file at the location I provided. I don’t know what’s different after pushing the files online, I also use JSONs for localization and it works fine there. Saving the UI to a snipper server and then using parseFromSnipperAsync() works, but I would prefer to use a JSON to better keep track of my layouts. Any ideas for what’s wrong?
Sometimes it may happen because of some bundler settings which don’t suit your server settings, often it is related to relative URLs.
So check if the JSON file is there, and if it is there why it’s URL is wrong.
See this thread, for example - removing extra slash in config solved the build problem: Project setup using Vite with CI/CD on GitHub Actions - #7 by labris
Hi, thank you for your time. I’m using webpack to build my project, not Vite. I don’t really know if it changes much of anything, I’m not well versed in web development. I tried your solution in my webpack.config.js but it didn’t work.
The NodeMaterial.Parse() throws an exception: “source.blocks is undefined”. I guess it doesn’t accept a JSON file? Sorry for not being more helpful, I’m still new to web development.
Hello, thank you for your time. Yes, I imported the JSON and passed it to the method as you showed me, but peeking inside the parse method reveals it couldn’t find the ‘source.blocks’ property inside the parse method. I’m not familiar with this method, so I can’t help much.
Solving my own topic: Inside my web.config file, I added the mime type definitions for .mp4 and .json files, as I assumed they would be accepted by default in firefox. I found it weird at first because I already tried that and it didn’t work, so I suppose it was just a typo. But I can now import my UI layouts and read videos just fine.