gloot icon indicating copy to clipboard operation
gloot copied to clipboard

Inherited prototype not found assertion failed

Open Viomi opened this issue 3 months ago • 2 comments

Having the same error as here, but in Godot 4.5: https://github.com/peter-kish/gloot/issues/301 Gloot version is 3.0.1 I don't think the cause of the error is the same as gloot no longer depends on the prototype being inherited, and I have not re-loaded my project so the JSON has not been re-ordered. When editing items in an inventory via editor, it shows the inherited properties. However, on run, I get this error:

E 0:00:01:536   Prototype._find_derived_prototype: Assertion failed: Prototype 'generic' not found!
  <GDScript Source>prototype.gd:127 @ Prototype._find_derived_prototype()
  <Stack Trace> prototype.gd:127 @ _find_derived_prototype()
                prototype.gd:121 @ get_derived_prototype()
                proto_tree.gd:78 @ deserialize()
                proto_tree_cache.gd:17 @ get_cached()
                inventory.gd:40 @ @protoset_setter()

Here is the JSON prototree being loaded in the inventory node:

{
	"generic": {
		"name": "itemname",
		"image": "res://icon.svg"
	},
	"fruit": {
		"inherits": "generic",
		"hungerfill": 1
	},
	"tools": {
		"inherits": "generic",
		"unlocked": false,
		"effectiveness": 1
	},
	"accessories": {
		"inherits": "generic"
	}
}

Viomi avatar Oct 11 '25 18:10 Viomi

This seems to only happen with .tres (json resources). If the file is saved as a .json, it works fine. So workaround is to use .json files instead of .tres files.

Viomi avatar Oct 11 '25 18:10 Viomi

Weird, I wasn't able to reproduce the problem with Godot 4.5. I created a scene that contains only an inventory with the same prototree you described. I added four items, each using a different prototype, ran the scene but no errors 🤔

Image

Any chance you could put together a minimal example that demonstrates the issue?

peter-kish avatar Oct 20 '25 19:10 peter-kish