Game.AggregateNetData
Assembly:
Assembly-CSharp (game/runtime assembly — typical for Cities: Skylines 2 mods)
Namespace:
Game.Prefabs
Type:
struct
Base:
IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
AggregateNetData is a small ECS component used by the game's prefab/aggregate network systems to carry an EntityArchetype reference. It is intended to be attached to entities within Unity.Entities (ECS) to record the archetype that should be used when creating or working with aggregated network-related entities (for example, combined/instanced net segments or prefab aggregates). The struct implements IEmptySerializable from Colossal.Serialization.Entities, indicating the game uses custom/engine serialization handling for this component type.
Fields
public Unity.Entities.EntityArchetype m_Archetype
Holds the Unity.Entities.EntityArchetype that describes the component composition for the associated aggregate network entity. This archetype is typically created via EntityManager.CreateArchetype and stored here so systems that instantiate aggregated prefabs can create entities with the correct set of components.
Properties
- This type declares no properties.
Constructors
public AggregateNetData()
No explicit constructor is defined in source — the default parameterless constructor is used. When instantiated, m_Archetype will have its default (empty/uninitialized) value until assigned.
Methods
- This type declares no methods.
Usage Example
using Unity.Entities;
using Game.Prefabs;
// Create an archetype describing the components for your aggregate net entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(
typeof(SomeNetComponent),
typeof(SomeOtherComponent)
);
// Create AggregateNetData and assign the archetype
var aggregateNetData = new AggregateNetData
{
m_Archetype = archetype
};
// Create an entity to store this component (or add the component to an existing entity)
var holderArchetype = entityManager.CreateArchetype(typeof(AggregateNetData));
var holderEntity = entityManager.CreateEntity(holderArchetype);
entityManager.SetComponentData(holderEntity, aggregateNetData);
Notes and tips: - EntityArchetype is a lightweight handle describing component layout. Do not assume it contains runtime instance data — it is used to create entities with the specified components. - Because the struct implements IEmptySerializable, the game's custom serialization system may treat this component specially; modders should be cautious when relying on default serialization behavior. - Use this component from systems or jobs that operate on query parameters (IQueryTypeParameter) to fetch or apply archetype-based instantiation logic.