ResourceUID

package
v0.0.0-...-5eaf078 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package ResourceUID provides methods for working with ResourceUID object instances.

Index

Constants

View Source
const InvalidId Resource.UID = -1 //gd:ResourceUID.INVALID_ID

Variables

This section is empty.

Functions

func AddId

func AddId(id Resource.UID, path 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 [method has_id] beforehand, or use [method set_id] instead.

func Advanced

func Advanced() class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

func CreateId

func CreateId() int

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 [method add_id] or [method set_id].

func GetIdPath

func GetIdPath(id Resource.UID) string

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 [method has_id] beforehand.

func HasId

func HasId(id Resource.UID) bool

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

func IdToText

func IdToText(id Resource.UID) string

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

func RemoveId

func RemoveId(id Resource.UID)

Removes a loaded UID value from the cache. Fails with an error if the UID does not exist, so be sure to check [method has_id] beforehand.

func SetId

func SetId(id Resource.UID, path string)

Updates the resource path of an existing UID. Fails with an error if the UID does not exist, so be sure to check [method has_id] beforehand, or use [method add_id] instead.

func TextToId

func TextToId(text_id string) int

Extracts the UID value from the given [code]uid://[/code] string.

Types

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.ResourceUID

Resource UIDs (Unique IDentifiers) allow the engine to keep references between resources intact, even if files are renamed or moved. They can be accessed with [code]uid://[/code]. [ResourceUID] keeps track of all registered resource UIDs in a project, generates new UIDs, and converts between their string and integer representations.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL