Is there a known problems with [Export] properties not being initialized correctly sometimes (3.4 RC2)?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By René Ruppert

I’m using the 3.4 RC2 Mono build.

My game has a a base class ActionTile which exposes two property:

public class ActionTile
{
  [Export] public string Id {get; set;} = string.Empty;
  [Export] public Vector2 TilePosition {get; set;} = Vector2.Inf;
}

Then, ActionTileDoor inherits from it and adds another property:

public class ActionTileDoor
{
  [Export] public bool CanOpen {get; set;} = true;
}

In the editor, I can set the Id and TilePosition just fine. However, I observe:

  • Sometimes, the value for the ID simply disappears in the editor when going firth and back.
  • Sometimes when running the game, TilePosition is reported as Vector2.Inf, although the editor is showing the correct values. If I restart the game multiple times, it works.

This means, the properties revert to their default values, as specified in code.
I’m wondering if it has to do with the inheritance hierarchy and in which order properties get initialized. I would not know how and why that would happen, though.

When does Godot set the values of exported properties? Is using default values for exported properties unsupported?

I will also go back to the stable build and try there.