reckfellENGINE

ResourceFormatSaver

Custom resource-format write handler.

On this page
class ResourceFormatSaverReckfellSharpInherits RefCounted

Implement a C# subclass with _Recognize, _GetRecognizedExtensions and _Save. Register its instance using ResourceSaver.AddResourceFormatSaver before Save and unregister before Dispose. Declaring the class does not replace this lifecycle.

ResourceSaver selects a handler by object and path. _Save must write data and return a truthful Error. Flags, dependencies, UIDs, atomic replacement and backups are not implemented for you.

Underscore methods are intended for overriding. Call ResourceSaver.Save for ordinary saves. Documented absent-override values refer to the native handler.

custom resource format: complete executable C# example.

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

Constructors1

ResourceFormatSaverConstructor
# ResourceFormatSaver
C#
public ResourceFormatSaver();

Creates an unregistered save handler. Implement a subclass and register its instance with ResourceSaver before Save.

Methods5

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

Lists save extensions for the specific object. Keep the result consistent with _Recognize and do not advertise extensions for an unsupported type.

Parameters
NameTypeDefault
resourceResource—
resource

Object to inspect or save. Check the supported concrete type, not just Resource inheritance.

Returns string[]

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

_Recognizebool
# _Recognize
C#
public virtual bool _Recognize(Resource resource);

Checks support for the object by its type and format capabilities. _RecognizePath checks the path separately. Without an override the native handler returns false.

Parameters
NameTypeDefault
resourceResource—
resource

Object to inspect or save. Check the supported concrete type, not just Resource inheritance.

Returns bool

true for a supported object. This does not establish a successful write or file accessibility.

_RecognizePathbool
# _RecognizePath
C#
public virtual bool _RecognizePath(Resource resource, string path);

Checks support for the object’s save path. Without an override the native implementation case-insensitively matches its extension against _GetRecognizedExtensions(resource). An override replaces this check; selecting a format does not open the file.

Parameters
NameTypeDefault
resourceResource—
pathstring—
resource

Object to inspect or save. Check the supported concrete type, not just Resource inheritance.

path

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

Returns bool

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

_SaveError
# _Save
C#
public virtual Error _Save(Resource resource, string path, uint flags);

Writes the object in the custom format and returns Error. Check opening, serialization and writing; do not return Ok after failure. Flags, atomic replacement and backups are not automatically implemented.

Parameters
NameTypeDefault
resourceResource—
pathstring—
flagsuint—
resource

Object to inspect or save. Check the supported concrete type, not just Resource inheritance.

path

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

flags

ResourceSaver.SaverFlags bitmask. Implement flags applicable to the format or explicitly reject unsupported ones.

Returns Error

Error.Ok after a successful write, or a failure code. Without an override the native handler returns MethodNotFound.

_SetUidError
# _SetUid
C#
public virtual Error _SetUid(string path, long uid);

Updates a UID stored in the custom-format file. Separate from _Save and not a path rename. Without an override the native handler returns FileUnrecognized.

Parameters
NameTypeDefault
pathstring—
uidlong—
path

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

uid

New numeric resource UID. Store it in a form understood by the corresponding format loader.

Returns Error

Error.Ok after updating the UID, or a specific Error for failure or an unsupported format.

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.