Game.Net.LabelExtents
Assembly: Assembly-CSharp (typical for game code / mods)
Namespace: Game.Net
Type: struct
Base: System.ValueType (implements interfaces below)
Summary:
LabelExtents is a lightweight ECS component used by the game's networking / label systems to store a 2D axis-aligned bounding box (AABB) for a label or UI element. It is a plain data container (struct) with a single Bounds2 field. The struct implements IComponentData so it can be attached to Unity.Entities entities, IQueryTypeParameter to participate in performant query APIs, and IEmptySerializable to participate in the game's serialization pipeline.
Fields
public Colossal.Mathematics.Bounds2 m_Bounds
Stores the 2D bounds for the labelled object. Bounds2 represents an axis-aligned 2D bounding box (AABB) used throughout the game math utilities to describe min/max or center/half-size extents in 2D space. This field is the only data carried by the component and is intended to be read/written by systems that compute or consume label extents.
Properties
- (none)
Constructors
- (implicit)
public LabelExtents()
No explicit constructors are defined in source; the default parameterless struct constructor is used. Instantiate and set m_Bounds directly when creating component data.
Methods
- (none)
Usage Example
using Unity.Entities;
using Colossal.Mathematics;
using Game.Net;
// Create or acquire an EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
// Create an entity and attach LabelExtents
var entity = em.CreateEntity();
var extents = new LabelExtents
{
// Construct or assign a Bounds2 value appropriate for your use.
// Bounds2 constructors vary; here we initialize with the default and
// assume you'll set fields according to your Bounds2 API.
m_Bounds = new Bounds2()
};
em.AddComponentData(entity, extents);
// Later, read/update the extents
var readExtents = em.GetComponentData<LabelExtents>(entity);
// Modify and write back
readExtents.m_Bounds = /* compute new bounds */;
em.SetComponentData(entity, readExtents);
Notes: - Use this component in ECS systems that compute or filter entities by label geometry or visibility. - Because this is a plain struct with a single Bounds2 field, it is cheap to add/remove and copy in bulk ECS operations. - If you need to serialize or network label extents, rely on the game's serialization conventions in combination with IEmptySerializable semantics; the presence of IEmptySerializable in the type indicates it participates in the game's specialized serialization mechanisms.