-
Notifications
You must be signed in to change notification settings - Fork 276
Description
Tested versions
- Reproducible in: v4.4.stable.mono.official [e36cb51]
System information
Redot v4.4.stable.mono - macOS Unknown (26.2.0) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M4 (Apple9) - Apple M4 (10 threads)
Issue description
When using Godot.Collections.Dictionary<string, T> where T is a class that inherits from GodotObject (such as Container), the dictionary returns null values at runtime even though the values are properly set in the Redot editor.
Expected behavior:
The dictionary should return the actual Container objects that were assigned in the editor. The output should display the container objects with their proper string representations.
Example expected output:
container1: Container:<Container#12345>
container2: Container:<Container#67890>
Actual behavior:
The dictionary returns null for all values, even though the keys are present and the values were set in the editor.
Actual output:
container1: null
container2: null
Additional context:
- The issue specifically occurs when the value type
TinDictionary<string, T>is a class that inherits fromGodotObject - The keys in the dictionary are accessible and correct
- Only the values are returning
null - This appears to be a serialization/deserialization issue with GodotObject-derived types in dictionaries
Steps to reproduce
- Create a C# script that inherits from a Godot node (e.g.,
Control) - Add an exported field of type
Godot.Collections.Dictionary<string, Container>whereContaineris a class inheriting fromGodotObject - Populate the dictionary in the Redot editor with key-value pairs
- Access the dictionary values at runtime in the
_Ready()method - Observe that the values are
nullinstead of the expectedContainerobjects
Code example:
using Godot;
public partial class TestGodotDictionary : Control
{
[Export] private Godot.Collections.Dictionary<string, Container> _containers;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
foreach (var container in _containers)
{
GD.Print($"{container.Key}: {(container.Value == null ? "null" : container.Value.ToString())}");
}
}
}Minimal reproduction project (MRP)
Metadata
Metadata
Assignees
Type
Projects
Status