Table of Contents

Class ResourceUidInstance

Namespace
Godot
Assembly
GodotSharp.dll

Resource UIDs (Unique IDentifiers) allow the engine to keep references between resources intact, even if files can renamed or moved. They can be accessed with uid://.

ResourceUid keeps track of all registered resource UIDs in a project, generates new UIDs, and converts between their string and integer representations.

[GodotClassName("ResourceUID")]
public class ResourceUidInstance : GodotObject, IDisposable
Inheritance
ResourceUidInstance
Implements
Inherited Members

Methods

AddId(long, string)

Adds a new UID value which is mapped to the given resource path.

Fails with an error if the UID already exists, so be sure to check HasId(long) beforehand, or use SetId(long, string) instead.

public void AddId(long id, string path)

Parameters

id long
path string

CreateId()

Generates a random resource UID which is guaranteed to be unique within the list of currently loaded UIDs.

In order for this UID to be registered, you must call AddId(long, string) or SetId(long, string).

public long CreateId()

Returns

long

GetIdPath(long)

Returns the path that the given UID value refers to.

Fails with an error if the UID does not exist, so be sure to check HasId(long) beforehand.

public string GetIdPath(long id)

Parameters

id long

Returns

string

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

HasId(long)

Returns whether the given UID value is known to the cache.

public bool HasId(long id)

Parameters

id long

Returns

bool

IdToText(long)

Converts the given UID to a uid:// string value.

public string IdToText(long id)

Parameters

id long

Returns

string

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

RemoveId(long)

Removes a loaded UID value from the cache.

Fails with an error if the UID does not exist, so be sure to check HasId(long) beforehand.

public void RemoveId(long id)

Parameters

id long

SetId(long, string)

Updates the resource path of an existing UID.

Fails with an error if the UID does not exist, so be sure to check HasId(long) beforehand, or use AddId(long, string) instead.

public void SetId(long id, string path)

Parameters

id long
path string

TextToId(string)

Extracts the UID value from the given uid:// string.

public long TextToId(string textId)

Parameters

textId string

Returns

long