reckfellENGINE

ResourceUid

Asset identifiers and UID-to-path registry.

On this page
class ResourceUidReckfellSharp

A UID identifies an asset, contains no asset data and is not a game Entity ID. Numeric value, uid:// text and path are different representations. Candidate creation, file-header changes and path registration are separate operations.

CreateId()/CreateIdForPath() do not register results. HasId() checks a map, not a file. PathToUid() can return the original path; current SetId() can leave an old reverse entry even after RemoveId(), a reproduced defect.

Use normal editor tools for ordinary asset operations; manage an owned runtime map explicitly and never dispose the engine-owned Singleton. ResourceSaver.SetUid does not replace registration. Tests were Windows headless; editor scanning, cross-process cache and other platforms remain untested.

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

Properties1

SingletonProperty
# Singleton
C#
public static ResourceUidInstance 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.

Methods12

AddIdvoid
# AddId
C#
public static void AddId(long id, string path);

Adds an ID→path process-registry entry and, with reverse cache enabled, path→ID. Creates no file, changes no file UID header and renames no asset. An existing ID is rejected with a diagnostic. Supply an owned valid ID and exact path; map mutation does not certify persisted cache updates.

Parameters
NameTypeDefault
idlong—
pathstring—
id

Nonnegative ID; account for registry membership/ownership for map operations.

path

Exact asset path; the method does not create or move the file.

CreateIdlong
# CreateId
C#
public static long CreateId();

Generates a nonnegative 63-bit candidate absent from the current registry. Does not reserve it, call AddId or create a file. Generator failure can return InvalidId. Obtaining an ID proves no asset existence; perform AddId separately for an owned registration.

Returns long

Nonnegative unregistered candidate or InvalidId.

CreateIdForPathlong
# CreateIdForPath
C#
public static long CreateIdForPath(string path);

Creates a candidate seeded by project name, lowercased path and content MD5, skipping registered IDs. Registers nothing and creates no file. Repetition without registration gave the same ID; content/project/registry changes need not. A nonexistent path can also yield a valid candidate, so this is neither an existence test nor stable content addressing.

Parameters
NameTypeDefault
pathstring—
path

Exact asset path; the method does not create or move the file.

Returns long

Unregistered candidate; not proof of an existing file.

EnsurePathstring
# EnsurePath
C#
public static string EnsurePath(string pathOrUid);

Uses UidToPath() for strings starting with uid://; otherwise returns input unchanged even if no file exists. Creates no directory, checks no permissions and is not complete input validation. Unknown UIDs inherit UidToPath() diagnostics/empty result.

Parameters
NameTypeDefault
pathOrUidstring—
pathOrUid

Ordinary path or uid://; an ordinary path is returned without existence validation.

Returns string

Resolved UID path or unchanged ordinary path; existence is not guaranteed.

GetIdPathstring
# GetIdPath
C#
public static string GetIdPath(long id);

Gets the registered ID path without opening or validating the file. In runtime validate a nonnegative ID and HasId() first. InvalidId/unknown IDs can produce diagnostics and empty string. Editor fallback/scanning differs and was not executed here.

Parameters
NameTypeDefault
idlong—
id

Nonnegative ID; account for registry membership/ownership for map operations.

Returns string

Registered path or empty on absence/error.

HasIdbool
# HasId
C#
public static bool HasId(long id);

Checks a key in the current registry, not a disk file or reverse-map freshness. Can be false after RemoveId() while an old reverse path from SetId remains; tested. Does not scan the project or load a resource.

Parameters
NameTypeDefault
idlong—
id

Nonnegative ID; account for registry membership/ownership for map operations.

Returns bool

True for a current registry key; not a file/reverse-map check.

IdToTextstring
# IdToText
C#
public static string IdToText(long id);

Encodes a nonnegative ID as uid:// text without checking registration or file existence. Any negative value yields uid://<invalid>. ID encoding, not registration creation or asset-content serialization.

Parameters
NameTypeDefault
idlong—
id

Nonnegative ID; account for registry membership/ownership for map operations.

Returns string

uid:// text or uid://<invalid> for negative values.

PathToUidstring
# PathToUid
C#
public static string PathToUid(string path);

Queries the path UID through ResourceLoader. Runtime uses reverse cache; unknown UID returns the original path, not InvalidId or necessarily empty string. A stale reverse path after SetId/RemoveId can return UID text with HasId() already false. Check result form/current registration; creates no file or UID.

Parameters
NameTypeDefault
pathstring—
path

Exact asset path; the method does not create or move the file.

Returns string

UID text or original path; distinguish them explicitly.

RemoveIdvoid
# RemoveId
C#
public static void RemoveId(long id);

Removes the ID and its current reverse-path entry, not the file or embedded UID. If SetId previously left an old reverse path, RemoveId does not clear it; reproduced defect. Missing IDs produce diagnostics. Automatic persistence/rebuilding of the whole cache is not established by this operation.

Parameters
NameTypeDefault
idlong—
id

Nonnegative ID; account for registry membership/ownership for map operations.

SetIdvoid
# SetId
C#
public static void SetId(long id, string path);

Updates the path of an existing registered ID without moving the file. 1.0.0 limitation: adds the new reverse path but does not erase the old one, so PathToUid(oldPath) can still return that UID; reproduced. To avoid this in an owned runtime update, remove the old registration before adding the new path under the same ID instead of SetId; not atomic. Missing IDs produce diagnostics.

Parameters
NameTypeDefault
idlong—
pathstring—
id

Nonnegative ID; account for registry membership/ownership for map operations.

path

Exact asset path; the method does not create or move the file.

TextToIdlong
# TextToId
C#
public static long TextToId(string textId);

Parses uid:// as a nonnegative ID or InvalidId for rejected input. Not strict canonical UID validation: empty uid:// suffix gives 0, and overflow has no separate diagnostic. Checks no registry/file. For strict input compare canonical IdToText() and separately HasId().

Parameters
NameTypeDefault
textIdstring—
textId

uid:// text; canonical form and ID presence are separate checks.

Returns long

Numeric ID or -1; a numeric result does not establish registration.

UidToPathstring
# UidToPath
C#
public static string UidToPath(string uid);

Parses UID text and queries its registered path. Does not automatically find a moved file. Unknown/invalid IDs can produce diagnostics and empty string; check TextToId()/HasId() before runtime calls. A returned path proves no file existence.

Parameters
NameTypeDefault
uidstring—
uid

Registered UID text, not an ordinary file path.

Returns string

Registry path or empty result; not a filesystem check.

Fields and constants1

InvalidIdField
# InvalidId
C#
public const long InvalidId = -1;

The -1 constant for absent/invalid ID. Not a usable UID or an AddId/GetIdPath key. IdToText() maps negative values to uid://<invalid>, not a file path.

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.