Click or drag to resize

ResourceLoaderLoad Method (String, String, Boolean)

Loads a resource at the given path, caching the result for further access.

The registered ResourceFormatLoaders are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted.

An optional type_hint can be used to further specify the Resource type that should be handled by the ResourceFormatLoader. Anything that inherits from Resource can be used as a type hint, for example Image.

If no_cache is true, the resource cache will be bypassed and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists.

Returns an empty resource if no ResourceFormatLoader could handle the file.

GDScript has a simplified @GDScript.load built-in method which can be used in most situations, leaving the use of ResourceLoader for more advanced scenarios.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public static Resource Load(
	string path,
	string typeHint = "",
	bool noCache = false
)

Parameters

path
Type: SystemString

[Missing <param name="path"/> documentation for "M:Godot.ResourceLoader.Load(System.String,System.String,System.Boolean)"]

typeHint (Optional)
Type: SystemString

[Missing <param name="typeHint"/> documentation for "M:Godot.ResourceLoader.Load(System.String,System.String,System.Boolean)"]

noCache (Optional)
Type: SystemBoolean

[Missing <param name="noCache"/> documentation for "M:Godot.ResourceLoader.Load(System.String,System.String,System.Boolean)"]

Return Value

Type: Resource

[Missing <returns> documentation for "M:Godot.ResourceLoader.Load(System.String,System.String,System.Boolean)"]

See Also