[Doc] Document loading behavior with relative paths
(cherry picked from commit 2508c2e309
)
This commit is contained in:
parent
2114489e23
commit
3bb74adc45
|
@ -78,6 +78,7 @@
|
||||||
Returns an empty resource if no [ResourceFormatLoader] could handle the file.
|
Returns an empty resource if no [ResourceFormatLoader] could handle the file.
|
||||||
GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios.
|
GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios.
|
||||||
[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].
|
[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].
|
||||||
|
[b]Note:[/b] Relative paths will be prefixed with [code]"res://"[/code] before loading, to avoid unexpected results make sure your paths are absolute.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="load_threaded_get">
|
<method name="load_threaded_get">
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
# Load a scene called "main" located in the root of the project directory and cache it in a variable.
|
# 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.
|
var main = load("res://main.tscn") # main will contain a PackedScene resource.
|
||||||
[/codeblock]
|
[/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.
|
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] 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].
|
[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].
|
||||||
|
|
Loading…
Reference in New Issue