Game.Net.ArrowMaterial
Assembly:
Namespace: Game.Net
Type: struct
Base: ISharedComponentData, IQueryTypeParameter, IEmptySerializable
Summary: Represents a shared ECS component that carries an integer material index for "arrow" visuals used by the network/Net systems in Cities: Skylines 2. As a shared component, instances with the same m_Index value will be grouped together by the Unity ECS, which is useful for batching rendering or processing by material. Implements IQueryTypeParameter to be usable directly in entity query-type parameters and IEmptySerializable to participate in the game's custom serialization pipeline.
Fields
public int m_Index
Holds the material index (an integer identifier) used to select which arrow material/variant should be applied. Typical use is a small non-negative integer that maps to a material array or lookup used by the Net/arrow renderer. Because this is a shared component, entities with the same m_Index value will be grouped together.
Properties
- This type defines no properties.
Constructors
public ArrowMaterial()
Struct has the default parameterless constructor. Create and initialize inline, for example: new ArrowMaterial { m_Index = 2 }
Methods
- This type defines no methods.
Usage Example
// Add or set the ArrowMaterial shared component on an entity
var arrowMaterial = new ArrowMaterial { m_Index = 3 };
entityManager.SetSharedComponentData(entity, arrowMaterial);
// Create an entity archetype that includes the shared component (value can be set after creation)
var archetype = entityManager.CreateArchetype(typeof(ArrowMaterial), /* other component types */);
var e = entityManager.CreateEntity(archetype);
entityManager.SetSharedComponentData(e, new ArrowMaterial { m_Index = 1 });
// Query example: you can filter or group by shared component value when using queries
Entities.WithSharedComponentFilter(new ArrowMaterial { m_Index = 1 })
.ForEach((Entity ent, in SomeOtherComponent comp) =>
{
// process entities that use arrow material index 1
}).Schedule();
{{ Notes: - As an ISharedComponentData, ArrowMaterial's m_Index should be a value type suitable for grouping; changing the value moves the entity between shared-component groups (which is relatively expensive compared to changing plain component data). - Implemented interfaces: - IQueryTypeParameter: allows passing this type directly into query-building APIs. - IEmptySerializable: integration point for Colossal's custom serializer; it indicates this type participates in the game's serialization pipeline. - There are no custom equality/hash implementations in this struct; the default behavior for a single int field is sufficient for grouping. }}