Urho.Resources.ResourceCache Class

%Resource cache subsystem. Loads resources on demand and stores them for later access.

See Also: ResourceCache


public class ResourceCache : UrhoObject


Namespace: Urho.Resources
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Resources.ResourceCache are listed below.

See Also: UrhoObject

Public Constructors

Constructs a new instance of Urho.Resources.ResourceCache which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Resources.ResourceCache, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Resources.ResourceCache linked to a specific Context.

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

AutoReloadResourcesBoolean. Return whether automatic resource reloading is enabled. Or Enable or disable automatic reloading of resources as files are modified. Default false.
FinishBackgroundResourcesMsInt32. Return how many milliseconds maximum to spend on finishing background loaded resources. Or Set how many milliseconds maximum per frame to spend on finishing background loaded resources.
NumBackgroundLoadResourcesUInt32. Return number of pending background-loaded resources.
PackageFilesIReadOnlyList<Urho.IO.PackageFile>. Return added package files.
ReturnFailedResourcesBoolean. Return whether resources that failed to load are returned. Or Enable or disable returning resources that failed to load. Default false. This may be useful in editing to not lose resource ref attributes.
SearchPackagesFirstBoolean. Return whether when getting resources should check package files or directories first. Or Define whether when getting resources should check package files or directories first. True for packages, false for directories.
TotalMemoryUseUInt64. Return total memory use for all resources.
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.

Public Methods

AddManualResource(Resource) : Boolean
Add a manually created resource. Must be uniquely named.
AddPackageFile(String, UInt32) : Boolean
Add a package file for loading resources from by name. Optional priority parameter which will control search order.
AddPackageFile(PackageFile, UInt32) : Boolean
Add a package file for loading resources from. Optional priority parameter which will control search order.
AddResourceDir(String, UInt32) : Boolean
Add a resource load directory. Optional priority parameter which will control search order.
AddResourceRouter(ResourceRouter, Boolean)
Add a resource router object. By default there is none, so the routing process is skipped.
BackgroundLoadResource(StringHash, String, Boolean, Resource) : Boolean
Background load a resource. An event will be sent when complete. Return true if successfully stored to the load queue, false if eg. already exists. Can be called from outside the main thread.
Exists(String) : Boolean
Return whether a file exists by name.
GetAnimation(String, Boolean) : Animation
GetAnimationSet2D(String, Boolean) : AnimationSet2D
GetExistingResource(StringHash, String) : Resource
Fetches an already loaded resource of specific type and name.
GetFile(String, Boolean) : File
Open and return a file from the resource load paths or from inside a package file. If not found, use a fallback search with absolute path. Return null if fails. Can be called from outside the main thread.
GetFont(String, Boolean) : Font
Fetches a font stored as a resource.
GetImage(String, Boolean) : Image
Loads an image resource by name. 
GetJsonFile(String, Boolean) : JsonFile
GetMaterial(String, Boolean) : Material
GetMemoryBudget(StringHash) : UInt64
GetMemoryUse(StringHash) : UInt64
GetModel(String, Boolean) : Model
GetObjectAnimation(String, Boolean) : ObjectAnimation
GetParticleEffect(String, Boolean) : ParticleEffect
GetParticleEffect2D(String, Boolean) : ParticleEffect2D
GetPListFile(String, Boolean) : PListFile
GetPreferredResourceDir(String) : String
Return either the path itself or its parent, based on which of them has recognized resource subdirectories.
GetResource(StringHash, String, Boolean) : Resource
Return a resource by type and name. Load if not loaded yet. Return null if not found or if fails, unless SetReturnFailedResources(true) has been called. Can be called only from the main thread.
GetResourceFileName(String) : String
Return full absolute file name of resource if possible.
GetResourceRouter(UInt32) : ResourceRouter
Return a resource router by index.
GetShader(String, Boolean) : Shader
GetSound(String, Boolean) : Sound
GetSprite2D(String, Boolean) : Sprite2D
GetSpriteSheet2D(String, Boolean) : SpriteSheet2D
GetTechnique(String, Boolean) : Technique
GetTempResource(StringHash, String, Boolean) : Resource
Load a resource without storing it in the resource cache. Return null if not found or if fails. Can be called from outside the main thread if the resource itself is safe to load completely (it does not possess for example GPU data.)
GetTexture2D(String, Boolean) : Texture2D
Loads a 2D Texture resource by name. 
GetTexture3D(String, Boolean) : Texture3D
Loads a 3D Texture resource by name. 
GetTextureCube(String, Boolean) : Texture
Loads a Texture Cube resource by name. 
GetTmxFile2D(String, Boolean) : TmxFile2D
GetValueAnimation(String, Boolean) : ValueAnimation
GetXmlFile(String, Boolean) : XmlFile
PrintMemoryUsage() : String
Returns a formatted string containing the memory actively used.
Release all resources. When called with the force flag false, releases all currently unused resources.
ReleaseResource(StringHash, String, Boolean)
Release a resource by name.
ReleaseResources(String, Boolean)
Release resources of all types by partial name.
ReleaseResources(StringHash, Boolean)
Release all resources of a specific type.
ReleaseResources(StringHash, String, Boolean)
Release resources of a specific type and partial name.
ReloadResource(Resource) : Boolean
Reload a resource. Return true on success. The resource will not be removed from the cache in case of failure.
Reload a resource based on filename. Causes also reload of dependent resources if necessary.
RemovePackageFile(String, Boolean, Boolean)
Remove a package file by name. Optionally release the resources loaded from it.
RemovePackageFile(PackageFile, Boolean, Boolean)
Remove a package file. Optionally release the resources loaded from it.
Remove a resource load directory.
Remove a resource router object.
Reset dependencies for a resource.
SanitateResourceDirName(String) : String
Remove unnecessary constructs from a resource directory name and ensure it to be an absolute path.
SanitateResourceName(String) : String
Remove unsupported constructs from the resource name to prevent ambiguity, and normalize absolute filename to resource path relative if possible.
SetMemoryBudget(StringHash, UInt64)
StoreResourceDependency(Resource, String)
Store a dependency for a resource. If a dependency file changes, the resource will be reloaded.
SubscribeToFileChanged(Action<FileChangedEventArgs>) : Subscription
Subscribes to the FileChanged event raised by the ResourceCache (single subscriber).
SubscribeToLoadFailed(Action<LoadFailedEventArgs>) : Subscription
Subscribes to the LoadFailed event raised by the ResourceCache.
SubscribeToResourceBackgroundLoaded(Action<ResourceBackgroundLoadedEventArgs>) : Subscription
Subscribes to the ResourceBackgroundLoaded event raised by the ResourceCache.
SubscribeToResourceNotFound(Action<ResourceNotFoundEventArgs>) : Subscription
Subscribes to the ResourceNotFound event raised by the ResourceCache.
SubscribeToUnknownResourceType(Action<UnknownResourceTypeEventArgs>) : Subscription
Subscribes to the UnknownResourceType event raised by the ResourceCache.

Public Events

ResourceNotFoundEvent raised by any of the Get resource methods if the requested resource is not found.