Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TableReference

A serializable reference to a table collection, identified either by its name or by its collection GUID.
Read time 2 minutesLast updated 6 days ago

Definition

public struct TableReference : IEquatable<TableReference>

Remarks

A table reference identifies a table collection without holding a direct object reference, which keeps it lightweight and serializable. It stores either a collection name or a collection GUID; TableReference.ReferenceType reports which form is in use, and TableReference.IsEmpty is
true
when neither is set. Assign one implicitly from a string to reference by name, or call TableReference.FromGuid to reference by GUID. Name references are convenient in code, while GUID references keep resolving after a collection is renamed. Pair a table reference with a TableEntryReference to address a single entry, and resolve either against a ResourceDatabase or a ResourceTable.
Create references by name and by GUID, then inspect how each identifies its collection.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class TableReferenceOverviewExample { public void Run() { TableReference byName = "UI Text"; // implicit conversion from string TableReference byGuid = TableReference.FromGuid("6f1e2c0a9b3d4e5f8a1b2c3d4e5f6a7b"); Debug.Log(byName.ReferenceType); // Name Debug.Log(byGuid.ReferenceType); // Guid Debug.Log(byName.IsEmpty); // False } }}

Properties

Property

Description

IsEmptyWhether this reference points at nothing.
ReferenceTypeHow this reference identifies its collection.
TableCollectionNameThe name of the referenced collection, or null when the reference is empty or GUID-based.
TableCollectionNameGuidThe GUID of the referenced collection, or an empty GUID when the reference is empty or name-based.

Methods

Method

Description

EqualsChecks whether this reference equals another object.
GetHashCodeComputes a hash code for this reference.
ToStringReturns a readable string describing this reference.

Static Methods

Method

Description

FromGuidCreates a table reference that identifies a collection by its GUID.

Operators

Operator

Description

TableReferenceConverts a collection name into a name-based table reference.

Enums

Enum

Description

TableReference.TypeThe way a table reference identifies its collection.