karim.salama Posted November 18, 2021 Share Posted November 18, 2021 (edited) Hi, let's say we have a test.ui file which is loaded by script.usc both located in the same folder. script.usc: UserInterface ui = new UserInterface(engine.getGui(), "test.ui"); Apparently, the engine is not looking the "current" directory, but in "C:/Users/user/Unigine_sdk.../bin" where the editor is located. Is it possible to load the .ui file with a path relative to the script itself? Thanks in advance. Edited November 18, 2021 by karim.salama Link to comment
karim.salama Posted November 18, 2021 Author Share Posted November 18, 2021 By the way, this script is loaded using the -system_script argument. Link to comment
karim.salama Posted November 18, 2021 Author Share Posted November 18, 2021 I ended up replacing every path with a guid and it worked. Link to comment
andrea.padovani Posted February 3, 2022 Share Posted February 3, 2022 (edited) On 11/18/2021 at 4:00 PM, karim.salama said: I ended up replacing every path with a guid and it worked. I've the same problem trying to load my UI from relative path. Thanks to your post I'm now able to use the asset withing the project folder just replacing with "guid://xxxxxxxxx" but I don't think it's the ideal version. I also try to have the .ui file alongside the source folder like it was on the demo, but it's not working also in that way. EDIT: Thanks to karpych11 in this topic, I just found that I have to omit the data folder to load file by relative path. Works fine for me using the following code, with file in data\gui\ from Editor SDK: auto ui = UserInterface::create(gui, "gui/user_interface.ui"); Edited February 3, 2022 by andrea.padovani UPDATE Link to comment
Recommended Posts