Game.NetLaneGeometryData
Assembly:
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter, ISerializable
Summary:
Data component that holds basic geometry parameters for a net (road/track) lane. Primarily stores the lane size (float3) and several rendering/LOD related fields (minimum LOD and mesh layers). Implements Colossal's ISerializable for custom persistence (only the size is written/read), and is usable as an ECS component via IComponentData and as a query parameter via IQueryTypeParameter.
Fields
-
public float3 m_Size
Holds the lane geometry size (typically width/height/depth or other per-lane dimensions). This is the only field serialized by the ISerializable implementation. -
public int m_MinLod
Minimum LOD index for this lane's geometry. When deserialized via Deserialize it is set to 255 by default. As a plain struct field, its default value prior to any initialization is 0 (unless you set it explicitly). -
public MeshLayer m_GameLayers
Mesh layer flags used in-game. When deserialized it defaults to MeshLayer.Default. -
public MeshLayer m_EditorLayers
Mesh layer flags used in the editor. When deserialized it defaults to MeshLayer.Default.
Note: Only m_Size is persisted by Serialize/Deserialize; the other fields are set to defaults in Deserialize.
Properties
- None.
This type exposes no properties — only public fields.
Constructors
public NetLaneGeometryData()
(implicit default)
As a struct there is no user-defined constructor in the source. The implicit default constructor yields default/zeroed values for fields. After deserialization, the code explicitly sets m_MinLod to 255 and both mesh layer fields to MeshLayer.Default.
Methods
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the component state for persistence. Implementation writes only m_Size:-
writer.Write(m_Size);
-
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads the persisted data and applies defaults for the non-serialized fields: - reader.Read(out m_Size);
- m_MinLod = 255;
- m_GameLayers = MeshLayer.Default;
- m_EditorLayers = MeshLayer.Default;
These methods are part of Colossal.Serialization.Entities.ISerializable and use generic reader/writer interfaces.
Usage Example
// Creating and initializing
var laneGeom = new Game.Prefabs.NetLaneGeometryData {
m_Size = new Unity.Mathematics.float3(3.0f, 0.2f, 1.0f),
m_MinLod = 2,
m_GameLayers = MeshLayer.Default,
m_EditorLayers = MeshLayer.Default
};
// When serialized by the game's serializer, only m_Size will be written.
// On Deserialize, m_MinLod and the layer fields will be reset to their defaults
// (m_MinLod = 255, game/editor layers = MeshLayer.Default) unless the code
// sets them afterwards.
{{ Additional notes: - This struct is intended as a lightweight ECS component (IComponentData) and is suitable for use in DOTS jobs and entity queries. - The use of MeshLayer in this struct implies interplay with the rendering/mesh system — look up the MeshLayer type to understand available flags. - Because only m_Size is serialized, if you need to persist m_MinLod or the layer settings you must extend serialization logic or persist them elsewhere. }}