Node.LoadXml Could not find resource

KeithWillensonKeithWillenson USMember ✭✭

I am getting the following error

Could not find resource Models/node_walk_b_13_0_ground.mdl. You can omit this exception by subscribing to Urho.Application.UnhandledException event and set Handled property to True.

from this code:

                    string xmlFileName = "Test_Virtual_3d_Copy.xml";
                    Debug.WriteLine("filename" + ResourceCache.GetResourceFileName(xmlFileName));
                    XmlFile sceneFile = ResourceCache.GetXmlFile(xmlFileName);
                    Debug.WriteLine("sceneFile loaded " + sceneFile.Name);
                    // Debug.WriteLine("sceneFile " + sceneFile.ToDebugString("  ")); // if uncommented shows that the file has been loaded
                    Node siteNode = Scene.CreateChild();
                    siteNode.LoadXml(sceneFile.GetRoot(name: ""), true); // could be false, I don't know, it doesn't seem to make any difference
                catch (System.Exception e)

Test_Virtual_3d_Copy.xml was created by AssetImporter. It is located in the Data directory. Under the Data directory are Materials, Models, and Textures (directories that support Test_Virtual_3d_Copy.xml). It seems odd to me that Test_Virtual_3d_Copy.xml is found in the Data directory, but the program can not find the first model which is also in the Data directory. I have checked and clicked on Show All Files in the Solution Explorer, so all files are part of this project/solution, including Data/Test_Virtual_3d_Copy.xml and Data/Models/node_walk_b_13_0_ground.mdl. Every file in Data has the file property "Copy to Output Directory" set to "Copy if Newer"

The program, a slightly modified (no earth or moon, trying to load Test_Virtual_3d_Copy.xml instead) version of HoloUrhoSharp, is started with

        static void Main()
            var appViewSource = new UrhoAppViewSource<HelloWorldApplication>(new ApplicationOptions("Data"));
            appViewSource.UrhoAppViewCreated += OnViewCreated;

In c++ adding the resource directory "Data" to ResourceCache allows the complete loading of this file. I have another version of this xml with a full scene instead of just the visual scene node, but I can't get that to work either.

Sign In or Register to comment.