summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/doc_classes/@GDScript.xml
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-04-08 11:20:40 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-04-08 11:20:40 +0200
commit8f1b5d68f151a90ed82f684a51fbf14472fb5109 (patch)
tree788e42a8a2fe8a52e35141da22d3fe3209bd57bf /modules/gdscript/doc_classes/@GDScript.xml
parent0e16c3cc25f75a4e8721df0cd913c3d87b845c98 (diff)
parent2508c2e3093b3cb32a2aead46cef7d484e3148c9 (diff)
downloadredot-engine-8f1b5d68f151a90ed82f684a51fbf14472fb5109.tar.gz
Merge pull request #90039 from AThousandShips/load_relative_note
[Doc] Document loading behavior with relative paths
Diffstat (limited to 'modules/gdscript/doc_classes/@GDScript.xml')
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index 4869573972..07d917ea04 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -168,7 +168,7 @@
# Load a scene called "main" located in the root of the project directory and cache it in a variable.
var main = load("res://main.tscn") # main will contain a PackedScene resource.
[/codeblock]
- [b]Important:[/b] The path must be absolute. A relative path will always return [code]null[/code].
+ [b]Important:[/b] Relative paths are [i]not[/i] relative to the script calling this method, instead it is prefixed with [code]"res://"[/code]. Loading from relative paths might not work as expected.
This function is a simplified version of [method ResourceLoader.load], which can be used for more advanced scenarios.
[b]Note:[/b] Files have to be imported into the engine first to load them using this function. If you want to load [Image]s at run-time, you may use [method Image.load]. If you want to import audio files, you can use the snippet described in [member AudioStreamMP3.data].
[b]Note:[/b] If [member ProjectSettings.editor/export/convert_text_resources_to_binary] is [code]true[/code], [method @GDScript.load] will not be able to read converted files in an exported project. If you rely on run-time loading of files present within the PCK, set [member ProjectSettings.editor/export/convert_text_resources_to_binary] to [code]false[/code].