Jump to content

cached file path names


photo

Recommended Posts

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

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

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 by lightmap
Link to comment

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

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
×
×
  • Create New...