Infohazard.Core 1.4.1
Infohazard Core Utility Library
Loading...
Searching...
No Matches
Infohazard.Core.ComponentID Struct Reference

A serializable type used to uniquely identify a component relative to a root GameObject. More...

Public Member Functions

 ComponentID (Transform root, Component target)
 Construct a ComponentID with the given root and target by calculating the path to the target. More...
 
override string ToString ()
 
Get< T > (Transform root)
 Get the referenced component. More...
 
bool Equals (ComponentID other)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Properties

string Path [get]
 Path from this GameObject to the GameObject that holds the referenced component. More...
 
string Type [get]
 Type name of the referenced component. More...
 

Detailed Description

A serializable type used to uniquely identify a component relative to a root GameObject.

The root GameObject that holds the ComponentID may not be an actual transform.root, but rather just an ancestor of the referenced component. This type is mostly used in order to persist the states of individual components, keyed by their ID.

Constructor & Destructor Documentation

◆ ComponentID()

Infohazard.Core.ComponentID.ComponentID ( Transform  root,
Component  target 
)

Construct a ComponentID with the given root and target by calculating the path to the target.

Parameters
rootThe GameObject from which the reference originates.
targetThe component that is being referenced.

Member Function Documentation

◆ Equals() [1/2]

bool Infohazard.Core.ComponentID.Equals ( ComponentID  other)

◆ Equals() [2/2]

override bool Infohazard.Core.ComponentID.Equals ( object  obj)

◆ Get< T >()

T Infohazard.Core.ComponentID.Get< T > ( Transform  root)

Get the referenced component.

Parameters
rootThe GameObject from which the reference originates.
Template Parameters
TType to cast the component to.
Returns
The referenced component, or null if not found.
Type Constraints
T :Component 

◆ GetHashCode()

override int Infohazard.Core.ComponentID.GetHashCode ( )

◆ ToString()

override string Infohazard.Core.ComponentID.ToString ( )

Property Documentation

◆ Path

string Infohazard.Core.ComponentID.Path
get

Path from this GameObject to the GameObject that holds the referenced component.

◆ Type

string Infohazard.Core.ComponentID.Type
get

Type name of the referenced component.


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