Game.Prefabs.UtilityLaneData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType (implements IComponentData, IQueryTypeParameter, ISerializable)
Summary:
Represents per-prefab data for a utility lane within the game's ECS-driven prefab system. Holds references to related prefab entities used for local connections and node objects, plus rendering/placement parameters (visual capacity and hanging offset) and a UtilityTypes value describing which utility categories this lane supports. The custom serialization implementation only persists the UtilityTypes value as a single byte; entity references and floats are not serialized here and are typically handled elsewhere by the prefab system.
Fields
-
public Entity m_LocalConnectionPrefab
Reference to a prefab entity used for the first type of local connection associated with this utility lane. -
public Entity m_LocalConnectionPrefab2
Reference to an alternative or secondary local connection prefab for this lane. -
public Entity m_NodeObjectPrefab
Reference to a node object prefab associated with the lane (e.g., visual node model). -
public float m_VisualCapacity
A float controlling the visual representation of the lane's capacity (used by rendering or placement logic). -
public float m_Hanging
Vertical offset (hanging) applied to visuals of the lane or associated objects. -
public UtilityTypes m_UtilityTypes
Enum value describing which utility types this lane supports (e.g., electricity, water). This value is serialized as a single byte by the type's Serialize method.
Properties
- This type does not define any public properties. It exposes fields directly.
Constructors
public UtilityLaneData()
No explicit constructors are defined in source; the default parameterless struct constructor is used and members are value-initialized. Initialize fields manually when creating instances if non-default values are required.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the m_UtilityTypes field to the writer as a single byte:writer.Write((byte)m_UtilityTypes);
Other fields (Entity references and floats) are not written by this method. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads a single byte from the reader and assigns it to m_UtilityTypes:reader.Read(out byte value); m_UtilityTypes = (UtilityTypes)value;
This restores only the UtilityTypes value from serialized data.
Usage Example
// Create and initialize a UtilityLaneData instance for a prefab setup
var laneData = new UtilityLaneData
{
m_LocalConnectionPrefab = localConnEntity,
m_LocalConnectionPrefab2 = localConnEntity2,
m_NodeObjectPrefab = nodeObjEntity,
m_VisualCapacity = 2.5f,
m_Hanging = 0.75f,
m_UtilityTypes = UtilityTypes.Electric | UtilityTypes.Water
};
// The engine / serialization system will call Serialize/Deserialize as needed.
// Serialize persists only the m_UtilityTypes field as a single byte.