Game.Prefabs.PipelinePrefab
Assembly:
Assembly-CSharp (default Unity game assembly)
Namespace:
Game.Prefabs
Type:
class
Base:
NetGeometryPrefab
Summary:
PipelinePrefab is a NetGeometryPrefab-derived component used to define the component composition for pipeline network prefabs. It ensures pipeline-specific runtime components are present on the prefab (PipelineData, LocalConnectData, DefaultNetLane) and, when resolving archetype components, it adds the appropriate color component depending on whether the archetype includes an Edge or a Node (EdgeColor or NodeColor). The class is exposed in the Unity component menu via the [ComponentMenu("Net/Prefab/", new Type[] { })] attribute.
Fields
- This class declares no private or public fields.
Properties
- This class declares no additional properties.
Constructors
public PipelinePrefab()
PipelinePrefab has an implicit public parameterless constructor (no explicit constructor is defined in the source).
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the set of component types that should be present on the pipeline prefab. Implementation details:- Calls base.GetPrefabComponents(components) to gather shared components from NetGeometryPrefab.
- Adds ComponentType.ReadWrite
() to represent pipeline-specific data. - Adds ComponentType.ReadWrite
() to represent local connection points. -
Adds ComponentType.ReadWrite
() to include default lane information used by the net system. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adjusts archetype component set based on whether the archetype represents an Edge or a Node. Implementation details: - Calls base.GetArchetypeComponents(components).
- If components contains ComponentType.ReadWrite
(), it adds ComponentType.ReadWrite () so edges receive edge color data. - Else if components contains ComponentType.ReadWrite
(), it adds ComponentType.ReadWrite () so nodes receive node color data. - This conditional ensures the correct color component is present for the entity archetype representing the pipeline piece.
Additional notes: - Uses Unity.Entities.ComponentType to describe component read/write access for entity archetypes. - The class depends on Game.Net types (PipelineData, LocalConnectData, DefaultNetLane) and ECS types (Edge, Node, EdgeColor, NodeColor).
Usage Example
// Example: how the prefab's components get collected when the prefab is processed
var prefab = new PipelinePrefab();
var components = new HashSet<Unity.Entities.ComponentType>();
// base prefab components would normally be added by the prefab system
prefab.GetPrefabComponents(components);
// components now contains:
// - PipelineData (ReadWrite)
// - LocalConnectData (ReadWrite)
// - DefaultNetLane (ReadWrite)
// plus any components added by NetGeometryPrefab.GetPrefabComponents
// When building an entity archetype for an edge instance:
var archetypeComponents = new HashSet<Unity.Entities.ComponentType>();
// Suppose NetGeometryPrefab or other code already added Edge() to archetypeComponents
archetypeComponents.Add(Unity.Entities.ComponentType.ReadWrite<Game.Net.Edge>());
prefab.GetArchetypeComponents(archetypeComponents);
// archetypeComponents will now include EdgeColor (ReadWrite) because it contains Edge