ResourcePreloader
A node used to preload sub-resources inside a scene.
ResourcePreloader.swift:20class ResourcePreloader
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.
Superclasses
class Node
Base class for all scene objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func addResource(name: StringName, resource: Resource?
) Adds a resource to the preloader with the given
name
. If a resource with the givenname
already exists, the new resource will be renamed to “name
N” where N is an incrementing number starting from 2.func getResource(name: StringName
) -> Resource? Returns the resource associated to
name
.func getResourceList(
) -> PackedStringArray Returns the list of resources inside the preloader.
func hasResource(name: StringName
) -> Bool Returns
true
if the preloader contains a resource associated toname
.func removeResource(name: StringName
) Removes the resource associated to
name
from the preloader.func renameResource(name: StringName, newname: StringName
) Renames a resource inside the preloader from
name
tonewname
.