Table of Contents

Class ResourcePreloader

Namespace
Godot
Assembly
GodotSharp.dll

This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader. You can add the resources using the ResourcePreloader tab when the node is selected.

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

public class ResourcePreloader : Node, IDisposable
Inheritance
ResourcePreloader
Implements
Inherited Members

Constructors

ResourcePreloader()

public ResourcePreloader()

Properties

Resources

public Array Resources { get; set; }

Property Value

Array

Methods

AddResource(StringName, Resource)

Adds a resource to the preloader with the given name. If a resource with the given name already exists, the new resource will be renamed to "name N" where N is an incrementing number starting from 2.

public void AddResource(StringName name, Resource resource)

Parameters

name StringName
resource Resource

GetResource(StringName)

Returns the resource associated to name.

public Resource GetResource(StringName name)

Parameters

name StringName

Returns

Resource

GetResourceList()

Returns the list of resources inside the preloader.

public string[] GetResourceList()

Returns

string[]

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

HasResource(StringName)

Returns true if the preloader contains a resource associated to name.

public bool HasResource(StringName name)

Parameters

name StringName

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

RemoveResource(StringName)

Removes the resource associated to name from the preloader.

public void RemoveResource(StringName name)

Parameters

name StringName

RenameResource(StringName, StringName)

Renames a resource inside the preloader from name to newname.

public void RenameResource(StringName name, StringName newname)

Parameters

name StringName
newname StringName