lightmap Posted April 6, 2018 Share Posted April 6, 2018 Hello Program using Unigine saves mesh and mat files into folder. At restart, program delete folder with all contents and write new ones. But, probably, Unigine cached filenames updated not so fast as deletion and recreation happens - which leads to missing files. How do I update cache manually? thanks Link to comment
silent Posted April 9, 2018 Share Posted April 9, 2018 Hello! If you adding files dynamically at runtime, you will need to tell the filesystem that there is a new files available. You can do it via console command: filesystem_reload or manually by calling addKnownFile. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
lightmap Posted April 9, 2018 Author Share Posted April 9, 2018 Hello Tried Unigine.Console.get().run("filesystem_reload"); - not helped I think problem with cached materials but calling Materials.get().reloadMaterials(); cause System.AccessViolationException in UnigineSharp_x64d.dll, if called right after System.IO.Directory.Delete(file_path, true); how to refresh materials at runtime? Link to comment
silent Posted April 9, 2018 Share Posted April 9, 2018 Could you please attach a small test scene with repro so we can double check that there is no engine bug? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
lightmap Posted April 9, 2018 Author Share Posted April 9, 2018 (edited) Here test code create default new project c# in Unigine SDK, paste code in AppSystemLogic.cs, at second run it'll crush namespace UnigineApp { class AppSystemLogic : SystemLogic { // System logic, it exists during the application life cycle. // These methods are called right after corresponding system script's (UnigineScript) methods. public AppSystemLogic() { } public override int init() { // Write here code to be called on engine initialization. string file_path = "..\\contents\\"; System.Console.WriteLine("start"); if (System.IO.Directory.Exists(file_path)) { System.Console.WriteLine("delete"); System.IO.Directory.Delete(file_path, true); System.Console.WriteLine("reloadMaterials"); Materials.get().reloadMaterials();// UNCOMMENT TO HAVE AV } System.Console.WriteLine("CreateDirectory"); System.IO.Directory.CreateDirectory(file_path); Material material = Materials.get().findMaterial("new_test_mat");// check if material already created if (material == null) { System.Console.WriteLine("CreateNewMaterial"); material = Materials.get().findMaterial("mesh_base").inherit("new_test_mat");// AV System.Console.WriteLine("save NewMaterial"); material.save(file_path + "new_test_mat" + ".mat"); } System.Console.WriteLine("done"); return 1; } //.... same but this not recreates my initial problem with missing files Edited April 9, 2018 by lightmap Link to comment
lightmap Posted April 9, 2018 Author Share Posted April 9, 2018 one of differences that "Content" mapped as drive trough "subst R: some_folder" if "Content" folder located at local(not mapped) drives all seems works fine that not your problem I suppose Link to comment
vvvaseckiy Posted April 10, 2018 Share Posted April 10, 2018 Hello lightmap, It seem like this issue was caused by malfunctioning reloadMaterials(); function. The issue is already fixed, and the fix will be released with upcoming 2.7 SDK. Sorry for any inconvenience caused. Link to comment
Recommended Posts