mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Add file name conventions in the GDScript style guide (#3355)
This closes #2376.
This commit is contained in:
@@ -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
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user