ResourceLoader
A singleton for loading resource files.
ResourceLoader.swift:16class ResourceLoader
A singleton used to load resource files from the filesystem.
It uses the many ResourceFormatLoader
classes registered in the engine (either built-in or from a plugin) to load files into memory and convert them to a format that can be used by the engine.
Superclasses
class Object
Base class for all other classes in the engine.
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.
Types
Type members
static func addResourceFormatLoader(ResourceFormatLoader?, atFront: Bool
) Registers a new
ResourceFormatLoader
. The ResourceLoader will use the ResourceFormatLoader as described inload(path:typeHint:cacheMode:)
.static func exists(path: String, typeHint: String
) -> Bool Returns whether a recognized resource exists for the given
path
.static func getDependencies(path: String
) -> PackedStringArray Returns the dependencies for the resource at the given
path
.static func getRecognizedExtensionsForType(String
) -> PackedStringArray Returns the list of recognized extensions for a resource type.
static func getResourceUid(path: String
) -> Int Returns the ID associated with a given resource path, or
-1
when no such ID exists.static func hasCached(path: String
) -> Bool Returns whether a cached resource is available for the given
path
.static func load(path: String, typeHint: String, cacheMode: ResourceLoader.CacheMode
) -> Resource? Loads a resource at the given
path
, caching the result for further access.static func loadThreadedGet(path: String
) -> Resource? Returns the resource loaded by
loadThreadedRequest(path:typeHint:useSubThreads:cacheMode:)
.static func loadThreadedGetStatus(path: String, progress: GArray
) -> ResourceLoader.ThreadLoadStatus Returns the status of a threaded loading operation started with
loadThreadedRequest(path:typeHint:useSubThreads:cacheMode:)
for the resource atpath
. SeeThreadLoadStatus
for possible return values.static func loadThreadedRequest(path: String, typeHint: String, useSubThreads: Bool, cacheMode: ResourceLoader.CacheMode
) -> GodotError Loads the resource using threads. If
useSubThreads
istrue
, multiple threads will be used to load the resource, which makes loading faster, but may affect the main thread (and thus cause game slowdowns).static func removeResourceFormatLoader(ResourceFormatLoader?
) Unregisters the given
ResourceFormatLoader
.static func setAbortOnMissingResources(abort: Bool
) Changes the behavior on missing sub-resources. The default behavior is to abort loading.
class var godotClassName: StringName