scripting_development.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. .. _doc_scripting_development:
  2. Scripting development
  3. =====================
  4. GDScript
  5. --------
  6. Annotation guidelines
  7. ~~~~~~~~~~~~~~~~~~~~~
  8. ..
  9. This description intentionally avoids mention of implementation and
  10. compilation details because these are often inconsistent between annotations
  11. Create annotations for modifiers that act on the script or its code.
  12. Additionally, create annotations for behavior that is specific to the Godot
  13. engine and editor; if the primary purpose is to affect the way that the engine
  14. or editor treats or interacts with the script, implement the token as an
  15. annotation.
  16. Do not create annotations for general programming language features.
  17. ::
  18. # Affects how the editor treats this script.
  19. @icon("res://path/to/class/icon.svg")
  20. # Affects how the engine interacts with this script.
  21. @onready var character_name = $Label
  22. # static is a general programming language feature.
  23. static var num_players = 2
  24. For historical reasons, some existing annotations and keywords do not strictly
  25. follow these guidelines. Choosing between implementing a feature as an
  26. annotation or as a language keyword is a nuanced decision that should be made
  27. through discussion with other GDScript developers.