Game.Rendering.ColorGroupID
Assembly: Assembly-CSharp.dll (typical game assembly)
Namespace: Game.Rendering
Type: struct
Base: System.ValueType
Summary:
ColorGroupID is a small value-type wrapper around an integer index used to identify a color group in the rendering system. It provides equality operators and overrides Equals/GetHashCode so instances can be compared and used as keys in collections. The struct is a lightweight identifier rather than a container of color data.
Fields
private int m_Index
Internal integer index that identifies the color group. Default value is 0 for the default-constructed struct. Although the field is private, the struct is not explicitly readonly — treat instances as immutable identifiers.
Properties
- None.
There are no public properties; the identifier is exposed via the constructor and equality semantics.
Constructors
public ColorGroupID(int index)
Creates a ColorGroupID with the provided integer index. Use this to create distinct identifiers; note that the default (parameterless) struct will have an index of 0.
Methods
-
public static bool operator ==(ColorGroupID a, ColorGroupID b)
Compares two ColorGroupID values for equality by comparing their internal indices. -
public static bool operator !=(ColorGroupID a, ColorGroupID b)
Compares two ColorGroupID values for inequality by comparing their internal indices. -
public override bool Equals(object obj)
Overrides Object.Equals. Returns true when obj is a ColorGroupID with the same internal index. -
public override int GetHashCode()
Returns the hash code of the internal index (m_Index.GetHashCode()). Suitable for use as a dictionary key.
Usage Example
// Create identifiers
var idA = new ColorGroupID(1);
var idB = new ColorGroupID(2);
var idC = new ColorGroupID(1);
// Compare
bool equalAB = idA == idB; // false
bool equalAC = idA == idC; // true
// Use as dictionary key
var dict = new Dictionary<ColorGroupID, string>();
dict[idA] = "Primary";
if (dict.TryGetValue(idC, out var name))
{
// name == "Primary" because idA == idC
}
// Caution: default(ColorGroupID) has m_Index == 0
var defaultId = default(ColorGroupID);