reckfellENGINE

ResourceFormatLoader

Custom resource-format read handler.

On this page
class ResourceFormatLoaderReckfellSharpInherits RefCounted

Implement a C# subclass with _GetRecognizedExtensions, _HandlesType, _GetResourceType and _Load. Register its instance using ResourceLoader.AddResourceFormatLoader before the first Load and unregister before Dispose. Construction alone does not register the handler.

Underscore methods are engine callbacks. Documented default checks refer to native dispatch when no override exists. Use ResourceLoader.Load for ordinary reads rather than calling a callback directly.

_Load returns a Resource or an integer Error inside a Variant. Path recognition selects a handler without validating contents. Dependencies, UIDs, thread safety and cache modes need separate handling when the format uses them.

custom resource format: complete executable C# example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ResourceFormatLoaderConstructor
# ResourceFormatLoader
C#
public ResourceFormatLoader();

Creates an unregistered handler. Implement a subclass with callbacks and add its instance to ResourceLoader before the first read.

Methods11

_Existsbool
# _Exists
C#
public virtual bool _Exists(string path);

Checks resource existence. Without an override the native handler uses FileAccess. File presence does not establish valid contents or a successful later read.

Parameters
NameTypeDefault
pathstring—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

Returns bool

true when the handler considers the resource present; not a guarantee of a successful read.

_GetClassesUsedstring[]
# _GetClassesUsed
C#
public virtual string[] _GetClassesUsed(string path);

Reports class names used by file contents. Without an override the native handler adds the nonempty base resource-type result. Return names, not object instances.

Parameters
NameTypeDefault
pathstring—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

Returns string[]

Array of class-name strings; an empty array when no classes are reported.

_GetDependenciesstring[]
# _GetDependencies
C#
public virtual string[] _GetDependencies(string path, bool addTypes);

Lists external file references. Each entry is a path or uid::type::fallback_path; the type section is empty when addTypes=false. Trailing empty sections are omitted. Listing neither loads dependencies nor rewrites the file.

Parameters
NameTypeDefault
pathstring—
addTypesbool—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

addTypes

true adds a base type name after the first ::. Resource suits a script resource without a separate native type.

Returns string[]

Dependency-entry array. With UID and fallback path but no type: uid://...::::asset://data/item.rdata.

_GetRecognizedExtensionsstring[]
# _GetRecognizedExtensions
C#
public virtual string[] _GetRecognizedExtensions();

Lists file extensions the handler can read, such as rfnote without a dot. This informs loader selection rather than validating each file’s contents.

Returns string[]

Array of extensions without dots; an empty array provides no extensions for default selection.

_GetResourceScriptClassstring
# _GetResourceScriptClass
C#
public virtual string _GetResourceScriptClass(string path);

Reports the resource’s named script class separately from its built-in base type. It neither registers the class nor creates an object.

Parameters
NameTypeDefault
pathstring—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

Returns string

Named script-class name, or an empty string if no such name exists or the format does not report it.

_GetResourceTypestring
# _GetResourceType
C#
public virtual string _GetResourceType(string path);

Determines the built-in resource type for a path. Resource is valid for a supported custom C# resource. A C# class name does not by itself become a native ClassDB type.

Parameters
NameTypeDefault
pathstring—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

Returns string

Supported built-in type name, or an empty string when the path is not recognized.

_GetResourceUidlong
# _GetResourceUid
C#
public virtual long _GetResourceUid(string path);

Reads a persistent UID from a custom format. Overriding enables custom UID support; do not add an always--1 stub when the standard .uid mechanism is intended. Without an override the native handler reads path + .uid; creating that file belongs to the editor workflow, not this read.

Parameters
NameTypeDefault
pathstring—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

Returns long

Numeric UID, or -1 when no valid identifier exists. This is not a file path.

_HandlesTypebool
# _HandlesType
C#
public virtual bool _HandlesType(StringName type);

Reports support for a base type. Default native path recognition uses this callback for a nonempty type hint. Without an override no type support is declared.

Parameters
NameTypeDefault
typeStringName—
type

Built-in type hint, such as Resource. Explicitly handle every supported type.

Returns bool

true for a supported type; false allows this handler to be skipped for that type hint.

_LoadVariant
# _Load
C#
public virtual Variant _Load(string path, string originalPath, bool useSubThreads, int cacheMode);

Reads and validates the file after handler selection. Return a Resource in a Variant on success, or an integer Error on failure. Error.Ok in place of an object is not success: any integer is treated as an error code and produces no resource. Bound sizes before allocation.

Parameters
NameTypeDefault
pathstring—
originalPathstring—
useSubThreadsbool—
cacheModeint—
path

Actual read path after resource routing. Do not unconditionally substitute originalPath.

originalPath

Original logical path before remapping/import. It can differ from path; this is resource context rather than an instruction to read the source asset.

useSubThreads

Permission to use additional threads. true neither spawns them for your code nor makes the handler thread-safe.

cacheMode

Numeric ResourceFormatLoader.CacheMode value. Honor its intended dependency-loading and format-data update behavior.

Returns Variant

Variant containing a Resource on success or an integer Error on failure. An empty Variant neither creates a resource nor supplies a useful error code.

_RecognizePathbool
# _RecognizePath
C#
public virtual bool _RecognizePath(string path, StringName type);

Determines whether the handler suits a path and type hint. Without an override the native implementation matches extension suffixes case-insensitively and uses _HandlesType, not _GetResourceType, for a nonempty type. An override replaces that check.

Parameters
NameTypeDefault
pathstring—
typeStringName—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

type

Optional built-in type hint, such as Resource. An empty string imposes no type restriction in default path recognition.

Returns bool

true when the path suits the format. This selects a handler rather than validating contents or permissions.

_RenameDependenciesError
# _RenameDependencies
C#
public virtual Error _RenameDependencies(string path, Reckfell.Collections.Dictionary renames);

Rewrites external references in the file using the mapping and persists the result. Mutating only the supplied Dictionary is insufficient. Without an override the native handler returns Ok without rewriting anything; that code alone does not prove references were updated.

Parameters
NameTypeDefault
pathstring—
renamesReckfell.Collections.Dictionary—
path

Custom-format file path: logical asset:// or user:// as appropriate for its storage location.

renames

Dictionary of string paths: old path to new path. Rewrite references in the file; the mapping itself does not rename the file.

Returns Error

Error.Ok after successfully completing the supported operation, or a specific Error on failure.

ResourceFormatLoader.CacheMode

ValueDescription
Ignore = 0

Neither the main resource (the one requested to be loaded) nor any of its subresources are retrieved from cache nor stored into it. Dependencies (external resources) are loaded with ResourceFormatLoader.CacheMode.Reuse.

IgnoreDeep = 3

Like ResourceFormatLoader.CacheMode.Ignore, but propagated recursively down the tree of dependencies (external resources).

Replace = 2

Like ResourceFormatLoader.CacheMode.Reuse, but the cache is checked for the main resource (the one requested to be loaded) as well as for each of its subresources. Those already in the cache, as long as the loaded and cached types match, have their data refreshed from storage into the already existing instances. Otherwise, they are recreated as completely new objects.

ReplaceDeep = 4

Like ResourceFormatLoader.CacheMode.Replace, but propagated recursively down the tree of dependencies (external resources).

Reuse = 1

The main resource (the one requested to be loaded), its subresources, and its dependencies (external resources) are retrieved from cache if present, instead of loaded. Those not cached are loaded and then stored into the cache. The same rules are propagated recursively down the tree of dependencies (external resources).

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.