Hint fallback property as node when it is a node #89175
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #85492
A comprehensive (I hope) step by step of what is happening.
Node
at the top.Sprite2D
in the scene, build, and assign thatSprite2D
to ourMySprite
property..tscn
, it should look like this..tscn
, it will look like this.Sprite2D
has been serialized inline, instead of via its path. You can fiddle around by, e.g., setting metadata on theSprite2D
and see it is indeed the right node being serialized there, only not in the right way.My understanding of what is happening
When running a project, the process goes vaguely like this:
_build
callbacks for all plugins (and so, the one from the .NET module).In C#, we rely on the built assembly to retrieve information about exported properties. If the assembly is not built (e.g. the user manually cleaned it, the user just cloned their repo on another computer, etc.). We do not have information about exported properties available. When this is the case, Godot relies on fallbacks that are set here. This explains how we actually serialize the right node still. But this process always sets the exported property's hint to
PROPERTY_HINT_NONE
, which explains why it is serialized inline (PROPERTY_HINT_NODE_TYPE
is what triggers the serialization as path).The fix assumes that setting a fallback to a value of type
OBJECT
that is aNode
means we want to hint it asPROPERTY_HINT_NODE_TYPE
.