Skip to content

ResourceUid

Eduard Gushchin edited this page Jul 1, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.ResourceUid
Namespace Electron2D
Kind class
Category Resources

Overview

Manages stable unique identifiers for resource paths in an Electron2D project.

Syntax

public static class Electron2D.ResourceUid

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: ResourceUID / ResourceUid

Stable uid:// conversion and in-memory UID-to-path mapping for resource references.

Remarks

Resource UIDs let scene and resource files keep a stable uid:// reference while a resource is renamed or moved. The path remains available as a readable fallback for review tools and for projects that do not have a UID mapping loaded yet.

This class provides Electron2D's resource UID registry using the C# naming shape used by the runtime API. In Electron2D 0.1.0 Preview it is a static runtime facade, not an engine singleton object.

Thread Safety

All methods are safe to call from any thread. Methods that read or mutate the UID registry synchronize internally.

Since

This class is available since Electron2D 0.1.0 Preview.

Members

Member Kind Summary
InvalidId Field The value used when a resource UID is invalid or cannot be resolved.
AddId(System.Int64, System.String) Method Adds a UID mapping for a resource path.
CreateId() Method Creates a random UID that is not currently registered.
CreateIdForPath(System.String) Method Creates a deterministic UID candidate for a resource path.
EnsurePath(System.String) Method Returns a path, converting a uid:// value when needed.
GetIdPath(System.Int64) Method Gets the path currently associated with a UID.
HasId(System.Int64) Method Reports whether a UID is registered.
IdToText(System.Int64) Method Converts a UID value to uid:// text.
PathToUid(System.String) Method Converts a resource path to UID text when the path is registered.
RemoveId(System.Int64) Method Removes a registered UID.
SetId(System.Int64, System.String) Method Updates the path associated with an existing UID.
TextToId(System.String) Method Extracts a numeric UID from uid:// text.
UidToPath(System.String) Method Converts UID text to a registered resource path.

Member Details

InvalidId

Kind: Field

public const System.Int64 InvalidId

Summary

The value used when a resource UID is invalid or cannot be resolved.

Remarks

The text form of this value is uid://<invalid>.

Since

This constant is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid

AddId(System.Int64, System.String)

Kind: Method

public static System.Void AddId(System.Int64, System.String)(System.Int64 id, System.String path)

Summary

Adds a UID mapping for a resource path.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The UID value to register.
  • path: The resource path associated with id.

Exceptions

  • System.ArgumentException: Thrown when id is invalid or path is empty.
  • System.InvalidOperationException: Thrown when the UID or path is already registered.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.HasId(System.Int64)
  • Electron2D.ResourceUid.SetId(System.Int64,System.String)

CreateId()

Kind: Method

public static System.Int64 CreateId()()

Summary

Creates a random UID that is not currently registered.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

A positive UID value that can be registered with Electron2D.ResourceUid.AddId(System.Int64,System.String) or Electron2D.ResourceUid.SetId(System.Int64,System.String).

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid

CreateIdForPath(System.String)

Kind: Method

public static System.Int64 CreateIdForPath(System.String)(System.String path)

Summary

Creates a deterministic UID candidate for a resource path.

Remarks

If the path is already registered, the registered UID is returned. If the deterministic candidate collides with another registered path, the next free positive value is returned.

Parameters

  • path: The resource path used as the UID seed.

Returns

A positive UID value that is stable for path within this runtime contract.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid

EnsurePath(System.String)

Kind: Method

public static System.String EnsurePath(System.String)(System.String pathOrUid)

Summary

Returns a path, converting a uid:// value when needed.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • pathOrUid: A resource path or UID text.

Returns

The unchanged path when pathOrUid is not a UID, the mapped resource path for a known UID, or an empty string for an unknown or invalid UID.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.UidToPath(System.String)

GetIdPath(System.Int64)

Kind: Method

public static System.String GetIdPath(System.Int64)(System.Int64 id)

Summary

Gets the path currently associated with a UID.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The UID value to resolve.

Returns

The resource path associated with id.

Exceptions

  • System.InvalidOperationException: Thrown when the UID is not registered.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.HasId(System.Int64)

HasId(System.Int64)

Kind: Method

public static System.Boolean HasId(System.Int64)(System.Int64 id)

Summary

Reports whether a UID is registered.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The UID value to check.

Returns

true when id is known; otherwise, false.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid

IdToText(System.Int64)

Kind: Method

public static System.String IdToText(System.Int64)(System.Int64 id)

Summary

Converts a UID value to uid:// text.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The UID value to convert.

Returns

A uid:// string for valid positive values, or uid://<invalid> for invalid values.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.TextToId(System.String)

PathToUid(System.String)

Kind: Method

public static System.String PathToUid(System.String)(System.String path)

Summary

Converts a resource path to UID text when the path is registered.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • path: The resource path to convert.

Returns

The registered UID text, or path unchanged when no UID is registered.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.UidToPath(System.String)

RemoveId(System.Int64)

Kind: Method

public static System.Void RemoveId(System.Int64)(System.Int64 id)

Summary

Removes a registered UID.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The UID value to remove.

Exceptions

  • System.InvalidOperationException: Thrown when the UID is not registered.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid

SetId(System.Int64, System.String)

Kind: Method

public static System.Void SetId(System.Int64, System.String)(System.Int64 id, System.String path)

Summary

Updates the path associated with an existing UID.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • id: The registered UID value.
  • path: The new resource path for id.

Exceptions

  • System.ArgumentException: Thrown when id is invalid or path is empty.
  • System.InvalidOperationException: Thrown when the UID does not exist or the new path belongs to another UID.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.AddId(System.Int64,System.String)

TextToId(System.String)

Kind: Method

public static System.Int64 TextToId(System.String)(System.String textId)

Summary

Extracts a numeric UID from uid:// text.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • textId: The UID text to parse.

Returns

The parsed UID, or Electron2D.ResourceUid.InvalidId when the text is not a valid UID.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.IdToText(System.Int64)

UidToPath(System.String)

Kind: Method

public static System.String UidToPath(System.String)(System.String uid)

Summary

Converts UID text to a registered resource path.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • uid: The UID text to resolve.

Returns

The registered resource path, or an empty string when the UID is invalid or unknown.

Thread Safety

It is safe to call this method from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ResourceUid.PathToUid(System.String)

Clone this wiki locally