GD0102: The type of the exported member is not supported

Rule ID

GD0102

Category

Usage

Fix is breaking or non-breaking

Breaking - If the member type is changed

Non-breaking - If the [Export] attribute is removed

Enabled by default

Yes

Cause

An unsupported type is specified for a member annotated with the [Export] attribute when a Variant-compatible type is expected.

Rule description

Every exported member must be Variant-compatible so it can be marshalled by the engine.

  1. class SomeType { }
  2. // SomeType is not a valid member type because it doesn't derive from GodotObject,
  3. // so it's not compatible with Variant.
  4. [Export]
  5. public SomeType InvalidProperty { get; set; }
  6. // System.Int32 is a valid type because it's compatible with Variant.
  7. [Export]
  8. public int ValidProperty { get; set; }

How to fix violations

To fix a violation of this rule, change the member’s type to be Variant-compatible or remove the [Export] attribute.

When to suppress warnings

Do not suppress a warning from this rule. Members with types that can’t be marshalled will result in runtime errors.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.

Previous Next