godotengine / godotengine/godot
NodePath property targeting breaks when the targets script is overridden in an inherited scene.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Tested in 4.4-dev2_mono_win64 and 4.3-stable_mono_win64
### System information
Godot v4.4.dev2.mono - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 (NVIDIA; 31.0.15.4633) - AMD Ryzen 7 5800X 8-Core Processor (16 Threads)
### Issue description
When the target of an exported NodePath property has its script overridden in an inherited scene, the NodePath breaks and throws a ObjectDisposedException.
### Steps to reproduce
To reproduce this bug, one needs a BaseScene, an InheritedScene (created via "New Inherited Scene" of the BaseScene), a BaseScript, a OtherScript and finally one ScriptWithExport with one export of the type Node.
The BaseScene looks as follows:
BaseScene (BaseScript)
+ScriptWithExport (Exported variable Target targets BaseScene)
The InheritedScene looks like this:
InheritedScene (OtherScript)
+ScriptWithExport (Exported variable Target targets InheritedScene)
Inside the _Ready function of the ScriptWithExport function add one line which prints the Target.
While the BaseScene works as expected, the InheritedScene will throw an ObjectDisposedException. Replacing OtherScript with BaseScript in the Inherited Scene, will result in a working condition again.
The targeted node does not have to be the root node, the same error can be reproduced when any node has its script overridden and is the target of an exported NodePath property.
### Minimal reproduction project (MRP)
[minimal-repro-inheritance.zip](https://github.com/user-attachments/files/17188270/minimal-repro-inheritance.zip)
Contributor guide
Research direction
Start with the linked minimal-repro-inheritance.zip and reproduce the failure from ScriptWithExport._Ready, comparing BaseScene with InheritedScene after the target node’s script is overridden. Trace the inherited-scene handling for the exported NodePath target; done means the inherited scene prints its target without an ObjectDisposedException while the base scene continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100