[Solved] Failed to get factory prototype resource, but path is valid

I get this error like for no reason. Prototype path is valid, “Dynamic Prototype” is true. And I don’t know
why I getting this error.

print(some_variable_with_path) -- DEBUG:SCRIPT "/path/to/object.goc"
factory.set_prototype("#furnitureSpawner", some_variable_with_path)

If a game object prototype is not referenced from any collection that’s referenced via your bootstrap collection, it will not be included in the build. When this is the case, the factory will not find the goc at runtime.

To fix this, add a dummy reference to your prototype to a collection. In order to not instantiate this dummy, what you can do is create a collection that contain all your prototypes, and then add a collectionproxy component of it in your main collection. That way the collection (and everything in it) will be referenced but never created/instantiated.

2 Likes

Example

Example: Dynamic factories

2 Likes