Documentation
¶
Overview ¶
Package ResourceUID provides methods for working with ResourceUID object instances.
Index ¶
- Constants
- func AddId(id Resource.UID, path string)
- func Advanced() class
- func CreateId() int
- func GetIdPath(id Resource.UID) string
- func HasId(id Resource.UID) bool
- func IdToText(id Resource.UID) string
- func RemoveId(id Resource.UID)
- func SetId(id Resource.UID, path string)
- func TextToId(text_id string) int
- type Extension
- type ID
- type Instance
Constants ¶
const InvalidId Resource.UID = -1 //gd:ResourceUID.INVALID_ID
Variables ¶
This section is empty.
Functions ¶
func AddId ¶
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 ¶
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 RemoveId ¶
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.
Types ¶
type Extension ¶
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
type 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.
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.