ResourceManifest::save(manifest, "x.asset", "test") does not work


Please see the error:
[ERROR] A fatal error occurred and the program has to terminate!

  • Error: InvalidStateException

  • Description: Path in resource manifest cannot be made relative to: “test”. Path: “scenePrefab.asset”

  • In function: static void bs::ResourceManifest::save(const SPtr<bs::ResourceManifest> &, const bs::Path &, const bs::Path &)

  • In file: /Users/travis/build/GameFoundry/bsf/Source/Foundation/bsfCore/Resources/BsResourceManifest.cpp:122



Your last argument should be the path all stored resource paths will be made relative to. Unless “test” is the root of your resource hierarchy, you’ll need to provide a different path, or an empty path to skip that process altogether.


Hi BearishSun. I get it. Now I have another question, please see the code below:
gResources().save(scenePrefab, “test/scenePrefab.asset”, true, false);
HPrefab loadedScenePrefab = gResources().load<Prefab>(“test/scenePrefab.asset”);

If I keep both of the above lines, scene objects can be displayed, and if I comment the first line, the same scene objects will NOT be displayed. I am sure there is scenePrefab.asset file in test folder because the file is saved there when the program ran last time.


Hi. Loading the prefab is not enough, you should also call Prefab::instantiate() to actually add the objects from the prefab into the scene.


Yes, I have that line. Please see the part code:
HSceneObject sceneRoot = gSceneManager().getRootNode();
HPrefab scenePrefab = Prefab::create(sceneRoot, true);
gResources().save(scenePrefab, “test/scenePrefab.asset”, true, false);
SPtr manifest = gResources().getResourceManifest(“Default”);
ResourceManifest::save(manifest, “x.asset”, “test”);

SPtr<ResourceManifest> manifest2 = ResourceManifest::load("x.asset", "test");
HPrefab loadedScenePrefab = gResources().load<Prefab>("test/scenePrefab.asset");
HSceneObject newSceneHierarchy = loadedScenePrefab->instantiate();


My best guess is that something goes wrong with the manifest. The scene likely loads, but none of the resources do (You can confirm this by iterating through all the SceneObjects and their children, and see if they are all still there). If you print out the values in the manifest before saving and after loading I can probably give you more information.


Hi BearishSun,
If I comment the middle 4 line manifest relevant code, I can still reproduce the problem. Please give me some further instructions about how to printing.


I feel the problem is not relevant with manifest. Can you give me more advice?


You can retrieve a list of child objects from a SceneObject and recursively iterate through them to print out the scene hierarcy and confirm it is correct after load.

You can try looking up your resources from the manifest through ResourceManifest::filePathExists and confirm they are there after you load the manifest. Or you can use your debugger to confirm the resource paths are valid.


Hi BearishSun,
Thanks for the help. I added below code to my previous code:
for (int i = 0; i < 3; i++)

Looks the outputed hierarchy is good.

The entire code is at, please take a look.


Nothing obviously wrong stands out. There’s a bug report that resource references in the editor aren’t getting saved, it’s potentially true for the framework as well, so it could be that.


Thanks, BearishSun. Please investigate and fix it when you have time.