Game.Net.Aggregated
Assembly: Game
Namespace: Game.Net
Type: struct
Base: System.ValueType, implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary:
Aggregated is a small ECS component used to mark or link an entity to an "aggregate" entity. It stores a Unity.Entities.Entity reference (m_Aggregate) that represents the aggregate/parent entity used by the game's networking or aggregation logic. The type is blittable and suitable for use in jobs and component data storage.
Fields
public Unity.Entities.Entity m_Aggregate
Holds the Entity handle of the aggregate (parent) entity. When an entity is part of an aggregated representation (e.g., grouped for network transmission or logical grouping), this field points to that aggregate entity. Default value is Entity.Null (the default for Unity.Entities.Entity) when not set.
Properties
- None.
This struct exposes a single public field and does not declare properties.
Constructors
- None declared (uses the implicit default constructor).
The implicit default constructor initializes m_Aggregate to its default value (Entity.Null).
Methods
- None declared.
This component is a plain data container (IComponentData) and does not provide behavior itself. It is also marked with IEmptySerializable which affects how the serialization system treats it for the game's networking/serialization pipeline.
Usage Example
using Unity.Entities;
using Game.Net;
// Add the Aggregated component to an entity:
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity myEntity = entityManager.CreateEntity(); // example entity
Entity aggregateEntity = entityManager.CreateEntity();
// Mark myEntity as part of aggregateEntity
entityManager.AddComponentData(myEntity, new Aggregated { m_Aggregate = aggregateEntity });
// Read the aggregate reference later
Aggregated agg = entityManager.GetComponentData<Aggregated>(myEntity);
Entity parent = agg.m_Aggregate;