From a53ab273293e3813458b39f23f921791f0e0dbcf Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 4 May 2020 19:07:29 +0200 Subject: [PATCH] Add file name conventions in the GDScript style guide (#3355) This closes #2376. --- .../gdscript/gdscript_styleguide.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/getting_started/scripting/gdscript/gdscript_styleguide.rst b/getting_started/scripting/gdscript/gdscript_styleguide.rst index f25680f75..1ad3d5bf2 100644 --- a/getting_started/scripting/gdscript/gdscript_styleguide.rst +++ b/getting_started/scripting/gdscript/gdscript_styleguide.rst @@ -427,6 +427,26 @@ These naming conventions follow the Godot Engine style. Breaking these will make your code clash with the built-in naming conventions, leading to inconsistent code. +File names +~~~~~~~~~~ + +Use snake_case for file names. For named classes, convert the PascalCase class +name to snake_case:: + + # This file should be saved as `weapon.gd`. + extends Node + class_name Weapon + +:: + + # This file should be saved as `yaml_parser.gd`. + extends Object + class_name YAMLParser + +This is consistent with how C++ files are named in Godot's source code. This +also avoids case sensitivity issues that can crop up when exporting a project +from Windows to other platforms. + Classes and nodes ~~~~~~~~~~~~~~~~~