GD0101.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. GD0101: The exported member is static
  2. =====================================
  3. ==================================== ======================================
  4. Value
  5. ==================================== ======================================
  6. **Rule ID** GD0101
  7. **Category** Usage
  8. **Fix is breaking or non-breaking** Breaking - If the ``static`` keyword is removed
  9. Non-breaking - If the ``[Export]`` attribute is removed
  10. **Enabled by default** Yes
  11. ==================================== ======================================
  12. Cause
  13. -----
  14. A static member is annotated with the ``[Export]`` attribute. Static members
  15. can't be exported.
  16. Rule description
  17. ----------------
  18. Godot doesn't allow exporting static members.
  19. .. code-block:: csharp
  20. // Static members can't be exported.
  21. [Export]
  22. public static int InvalidProperty { get; set; }
  23. // Instance members can be exported.
  24. [Export]
  25. public int ValidProperty { get; set; }
  26. How to fix violations
  27. ---------------------
  28. To fix a violation of this rule, remove the ``[Export]`` attribute or remove the
  29. ``static`` keyword.
  30. When to suppress warnings
  31. -------------------------
  32. Do not suppress a warning from this rule. Static members can't be exported so
  33. they will be ignored by Godot, resulting in runtime errors.