Infohazard.Core 1.4.1
Infohazard Core Utility Library
Loading...
Searching...
No Matches
Infohazard.Core.UniqueNamedObject Class Reference

This script is used to assign a unique name to an object, which can then be used to find that object. More...

Static Public Member Functions

static bool TryGetObject (string name, out GameObject result)
 Try to get a GameObject with the given unique name, and return whether it was found. More...
 
static bool TryGetObject (UniqueNameListEntry entry, out GameObject result)
 Try to get a GameObject with the given unique name asset, and return whether it was found. More...
 

Properties

UniqueNameListEntry UniqueNameListEntry [get]
 Unique name asset for the object. More...
 
string UniqueName [get, private set]
 Unique name string for the object. More...
 
static IReadOnlyDictionary< string, UniqueNamedObjectObjects [get]
 Dictionary of all active UniqueNamedObjects keyed by their unique names. More...
 

Events

static Action< UniqueNamedObjectObjectAdded
 Invoked when a new UniqueNamedObject is added to the dictionary. More...
 
static Action< UniqueNamedObjectObjectRemoved
 Invoked when a UniqueNamedObject is removed from the dictionary. More...
 

Detailed Description

This script is used to assign a unique name to an object, which can then be used to find that object.

Unique names can be created under a UniqueNameList. The static methods in this class can be used to quickly find objects by their unique names. Since the unique names are asset references, there is no chance of making typos, and they can even be renamed without breaking references. There is nothing that prevents two objects from sharing the same name, but you will get a log error if they are active at the same time.

Member Function Documentation

◆ TryGetObject() [1/2]

static bool Infohazard.Core.UniqueNamedObject.TryGetObject ( string  name,
out GameObject  result 
)
static

Try to get a GameObject with the given unique name, and return whether it was found.

Parameters
nameThe name to search for.
resultThe object with that name, or null if not found.
Returns
Whether the object was found.

◆ TryGetObject() [2/2]

static bool Infohazard.Core.UniqueNamedObject.TryGetObject ( UniqueNameListEntry  entry,
out GameObject  result 
)
static

Try to get a GameObject with the given unique name asset, and return whether it was found.

Parameters
entryThe name asset to search for.
resultThe object with that name, or null if not found.
Returns
Whether the object was found.

Property Documentation

◆ Objects

IReadOnlyDictionary<string, UniqueNamedObject> Infohazard.Core.UniqueNamedObject.Objects
staticget

Dictionary of all active UniqueNamedObjects keyed by their unique names.

◆ UniqueName

string Infohazard.Core.UniqueNamedObject.UniqueName
getprivate set

Unique name string for the object.

◆ UniqueNameListEntry

UniqueNameListEntry Infohazard.Core.UniqueNamedObject.UniqueNameListEntry
get

Unique name asset for the object.

Event Documentation

◆ ObjectAdded

Action<UniqueNamedObject> Infohazard.Core.UniqueNamedObject.ObjectAdded
static

Invoked when a new UniqueNamedObject is added to the dictionary.

◆ ObjectRemoved

Action<UniqueNamedObject> Infohazard.Core.UniqueNamedObject.ObjectRemoved
static

Invoked when a UniqueNamedObject is removed from the dictionary.


The documentation for this class was generated from the following file: