"Invalid get/set index" error, but only at project loading

Godot Version

4.2.1

Question

When I opening a project I getting 2 “Invalid get index” errors:

Invalid get index 'sequence' (on base: 'Control (CVE_PatternPreview)')
Invalid set index 'pattern' (on base: 'Control (CVE_PatternPreview)') with value of type 'Resource (CVE_VisualPattern)'

But when I launch related scenes, no errors occur. I found many similar questions, and all the time the source of the problem really was a missing index at time, when error was generated. So, why may these two be absent when the project validates at opening?

First case - sequence:

@export var sequence_path: NodePath
@onready var sequence := get_node(sequence_path) as PointsSequence

Second case - pattern:

var pattern: CVE_VisualPattern = CVE_VisualPattern.base():
	set(value):
		pattern = value
		handle_pattern_update()

I have many other onready and set(value) properties at project, but only these two produce errors.

Looks like I found the answer by myself. Problem was related to tool usage. Part of code which uses CVE_PatternPreview was marked by @tooland loading at project loading. But CVE_PatternPreview by itself was not marked by @tool. For this reason everything works well when I launch an app (and all code loads), but not well at editor start (when only scripts marked as tool loads).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.