Game.Prefabs.NetLaneArchetypeData
Assembly:
Game
Namespace: Game.Prefabs
Type:
struct
Base:
IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
A small plain data component that holds a set of EntityArchetype references used for creating various lane-related entities in the ECS. This struct groups archetypes for different lane categories (regular lanes, area lanes, edge lanes, node lanes) and for their master/slave variants so code that spawns or initializes lane entities can reuse prebuilt archetypes rather than creating them repeatedly.
Fields
-
public EntityArchetype m_LaneArchetype
Archetype used for ordinary lane entities (the typical per-lane entity archetype used by the traffic/road systems). -
public EntityArchetype m_AreaLaneArchetype
Archetype used for area lane entities (lanes that are part of area/stub types, e.g., parking areas or similarly categorized lanes). -
public EntityArchetype m_EdgeLaneArchetype
Archetype used for edge lane entities (lanes that belong to an edge section of a network segment). -
public EntityArchetype m_EdgeSlaveArchetype
Archetype for an edge slave entity — a slave/child entity associated with an edge lane (used when edge lanes are split into master/slave relationships). -
public EntityArchetype m_EdgeMasterArchetype
Archetype for an edge master entity — the master/parent entity in an edge master/slave relationship. -
public EntityArchetype m_NodeLaneArchetype
Archetype used for node lane entities (lanes that are owned/controlled by a network node, e.g., intersection lane entities). -
public EntityArchetype m_NodeSlaveArchetype
Archetype for a node slave entity — a slave/child entity associated with a node lane. -
public EntityArchetype m_NodeMasterArchetype
Archetype for a node master entity — the master/parent entity in a node master/slave relationship.
Properties
- This type does not declare any C# properties. It exposes only the public fields listed above.
Constructors
public NetLaneArchetypeData()
As a struct, a default parameterless constructor exists implicitly. AllEntityArchetype
fields are default-initialized (typically to an empty/default archetype handle) and must be assigned valid archetypes before use.
Methods
- This struct does not define any methods. It only acts as a container for archetype references and implements marker/query interfaces (IComponentData, IQueryTypeParameter, IEmptySerializable).
Usage Example
// Example: create archetypes once and store them in the NetLaneArchetypeData component
using Unity.Entities;
// obtain EntityManager (example using default world)
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
// create archetypes (replace SomeLaneComponent/OtherComponent with the real components used by the mod)
var laneArchetype = em.CreateArchetype(typeof(SomeLaneComponent), typeof(TransformComponent));
var areaLaneArchetype = em.CreateArchetype(typeof(AreaLaneComponent), typeof(TransformComponent));
var edgeLaneArchetype = em.CreateArchetype(typeof(EdgeLaneComponent), typeof(TransformComponent));
var edgeSlaveArchetype = em.CreateArchetype(typeof(EdgeSlaveComponent), typeof(TransformComponent));
var edgeMasterArchetype = em.CreateArchetype(typeof(EdgeMasterComponent), typeof(TransformComponent));
var nodeLaneArchetype = em.CreateArchetype(typeof(NodeLaneComponent), typeof(TransformComponent));
var nodeSlaveArchetype = em.CreateArchetype(typeof(NodeSlaveComponent), typeof(TransformComponent));
var nodeMasterArchetype = em.CreateArchetype(typeof(NodeMasterComponent), typeof(TransformComponent));
// populate the component
var netLaneArchetypes = new NetLaneArchetypeData
{
m_LaneArchetype = laneArchetype,
m_AreaLaneArchetype = areaLaneArchetype,
m_EdgeLaneArchetype = edgeLaneArchetype,
m_EdgeSlaveArchetype = edgeSlaveArchetype,
m_EdgeMasterArchetype = edgeMasterArchetype,
m_NodeLaneArchetype = nodeLaneArchetype,
m_NodeSlaveArchetype = nodeSlaveArchetype,
m_NodeMasterArchetype = nodeMasterArchetype
};
// attach to a singleton entity or a manager entity so systems can read it
var singleton = em.CreateEntity();
em.AddComponentData(singleton, netLaneArchetypes);
// Later, systems can read netLaneArchetypes from that entity and use the stored archetypes