Skip to reading
GDScript Programming & Godot

49. External files, libraries and packaging

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView illustrations

GDScript does not use C-style headers or textual #include. Use extends for inheritance, preload/load for actual Godot files, and PCA’s script router for authored records. These are distinct forms of reuse.

Source table from 49. External files, libraries and packaging, page 58
You have…Use…
A PCA native/PCA/Lua/BASIC/visual recordCallScript or IncludeScript with its ID
A .gd file already in the Godot projectpreload/load, then new()
A .tscn/.scn PackedSceneload, type-check, instantiate, add_child
A custom Resourceload/ResourceLoader or ResourceSaver with a supported path
An extra addon/native extensionInstall/configure in the editable Godot project and export for the target

The normal desktop runner is precompiled. Its game pack includes the documented game data and asset tree; it is not a promise to collect arbitrary res://custom files mentioned in source. For new loose scripts, scenes, addons or native extensions, export an editable Godot project, add the files there, and build through Godot.

Keep extensions in a separate custom folder. Exporting a fresh PCA source project later does not automatically merge your previous custom Godot edits. Copy/reapply them deliberately, and test the exported game on a clean location.

Figure 16. Build Game offers Export Editable Godot Project for work that needs additional Godot files or project configuration.

Page 58 of 378Permalink
Go to page