reckfellENGINE

ResourceSaver

Resource saving through registered format handlers.

On this page
class ResourceSaverReckfellSharp

ResourceSaver.Save() saves a prepared Resource, not an arbitrary game tree. Resource, extension and registered savers select the format. .rdata is a text resource, .rbin binary; PackedEntity uses .rscene for levels and .rprefab for prefabs.

Check Error and backend capabilities. ChangePath has a reproduced failure-restoration limitation; SetUid() does not automatically update the runtime registry or form a transaction. Load compressed binary resources through ResourceLoader, not as ordinary archives.

Register an owned ResourceFormatSaver once and unregister before Dispose. The singleton belongs to the engine. Tests ran on Windows in an isolated process; editor callbacks, failed replacement and UID cache persistence across runs were not verified.

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

Properties1

SingletonProperty
# Singleton
C#
public static ResourceSaverInstance Singleton { get; }

Borrowed wrapper of the global engine service. Repeated access uses a cached managed wrapper, not a separate registry. Do not Free()/Dispose() this engine-owned object. Use the class static methods for ordinary work.

Methods6

AddResourceFormatSavervoid
# AddResourceFormatSaver
C#
public static void AddResourceFormatSaver(ResourceFormatSaver formatSaver, bool atFront = false);

Adds an owned ResourceFormatSaver to the global list; atFront=true gives priority over current handlers. The registry retains a native reference, but manage registration and managed lifetime explicitly. Registering the same instance again creates a duplicate; do not add before each Save. Returns no Error; invalid objects/capacity exhaustion produce diagnostics. Unregister before disposing an owned saver.

Parameters
NameTypeDefault
formatSaverResourceFormatSaver—
atFrontboolfalse
formatSaver

Owned saver instance; retain it until explicit unregistration.

atFront

True inserts first; false appends after current handlers.

GetRecognizedExtensionsstring[]
# GetRecognizedExtensions
C#
public static string[] GetRecognizedExtensions(Resource type);

Collects registered-saver extensions for a Resource instance; the type parameter is not C# typeof/a class name. Names have no dot; duplicates are possible and sorting is unspecified. The list guarantees no successful Save: a handler still checks recognition/path and may reject the operation. Contents depend on the resource and current plugin registration.

Parameters
NameTypeDefault
typeResource—
type

Resource instance whose extensions are queried; not System.Type.

Returns string[]

New dotless-extension string[] with possible duplicates.

GetResourceIdForPathlong
# GetResourceIdForPath
C#
public static long GetResourceIdForPath(string path, bool generate = false);

Delegates a UID request to an optional callback, typically configured by the editor. Not ResourceUid.CreateIdForPath or a general UID factory. Without the callback it returns InvalidId even with generate=true, confirmed in a headless game process. Does not automatically inspect the whole file/registry or guarantee UID persistence.

Parameters
NameTypeDefault
pathstring—
generateboolfalse
path

Path supplied to the callback, not uid:// text.

generate

Allow generation by a supporting callback; without a callback still InvalidId.

Returns long

Callback UID or ResourceUid.InvalidId; generate=true guarantees no new value.

RemoveResourceFormatSavervoid
# RemoveResourceFormatSaver
C#
public static void RemoveResourceFormatSaver(ResourceFormatSaver formatSaver);

Removes the first registration of that instance. If added twice, one Remove leaves another registration; tested. Does not automatically dispose your managed wrapper or delete saved files. Missing/null savers produce diagnostics; track whether Add occurred during normal lifecycle.

Parameters
NameTypeDefault
formatSaverResourceFormatSaver—
formatSaver

The same registered instance; removes one registration.

SaveError
# Save
C#
public static Error Save(Resource resource, string path = "", ResourceSaver.SaverFlags flags = ResourceSaver.SaverFlags.None);

Saves a Resource through registered format savers: object and path are recognized before handler execution. Empty path uses ResourcePath; both empty is invalid. Failure can fall through to another handler; Ok is its report, not independent file verification. Concrete savers implement flags. In 1.0.0 ChangePath changes ResourcePath before calling and restores it only on success: failure can retain the new path, including after successful fallback. Reproduced. Not an atomic game save; a live Entity must be packed separately because Save takes a Resource.

Parameters
NameTypeDefault
resourceResource—
pathstring""
flagsResourceSaver.SaverFlagsResourceSaver.SaverFlags.None
resource

Live Resource ready for the selected format; not a game-tree Entity.

path

Destination with a suitable extension; empty uses current ResourcePath. Validate parents/access separately.

flags

Backend SaverFlags; Compress/SaveBigEndian apply to the binary saver. ChangePath has the described failure-restoration limitation.

Returns Error

Error from the last applicable handler; Ok is no independent write/atomicity certification.

SetUidError
# SetUid
C#
public static Error SetUid(string resource, long uid);

Asks a format saver to change an existing resource file UID; creates no game Entity and does not automatically register the path in ResourceUid. Check Error. The 1.0.0 text backend uses a temporary .uidren and remove/rename without propagating those replacement errors; a source-only limitation, not a transaction guarantee. Windows testing covered ordinary .rdata header changes, not replacement failures or editor scanning.

Parameters
NameTypeDefault
resourcestring—
uidlong—
resource

Path of an already saved resource file; a string, not a Resource object.

uid

Resource UID; validate validity/registration conflicts when managing it yourself.

Returns Error

Handler Error; text replacement does not validate every final filesystem operation.

ResourceSaver.SaverFlags

ValueDescription
BundleResources = 2

Bundles external resources.

ChangePath = 4

Changes the Resource.ResourcePath of the saved resource to match its new location.

Compress = 32

Compress the resource on save using FileAccess.CompressionMode.Zstd. Only available for binary resource types.

None = 0

No resource saving option.

OmitEditorProperties = 8

Do not save editor-specific metadata (identified by their __editor prefix).

RelativePaths = 1

Save the resource with a path relative to the scene which uses it.

ReplaceSubresourcePaths = 64

Take over the paths of the saved subresources (see Resource.TakeOverPath).

SaveBigEndian = 16

Save as big endian (see FileAccess.BigEndian).

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.