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
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
nameStringNameresourceResource
GetResource(StringName)
Returns the resource associated to name.
public Resource GetResource(StringName name)
Parameters
nameStringName
Returns
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
methodgodot_string_nameName of the method to check for.
Returns
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
signalgodot_string_nameName of the signal to check for.
Returns
HasResource(StringName)
Returns true if the preloader contains a resource associated to name.
public bool HasResource(StringName name)
Parameters
nameStringName
Returns
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
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
RemoveResource(StringName)
Removes the resource associated to name from the preloader.
public void RemoveResource(StringName name)
Parameters
nameStringName
RenameResource(StringName, StringName)
Renames a resource inside the preloader from name to newname.
public void RenameResource(StringName name, StringName newname)
Parameters
nameStringNamenewnameStringName