Game.Prefabs.NetVertexMatchData
Assembly: Assembly-CSharp (or your mod assembly)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A lightweight ECS component used to store offset information for matching or aligning network vertices (e.g., road/track vertex alignment). Holds a float3 representing the offset to apply during matching or placement logic. Designed for use with Unity's DOTS/ECS and Unity.Mathematics types.
Fields
public Unity.Mathematics.float3 m_Offsets
Stores the 3D offset (x, y, z) used when matching or aligning a net vertex. Values are expressed in the same units as the game's world space (typically meters). Because this is a value-type field on an IComponentData struct, it is cheap to copy and safe to store per-entity.
Properties
- None.
This struct exposes its data via the public field m_Offsets rather than properties to remain blittable and efficient for ECS usage.
Constructors
-
Implicit parameterless constructor (default)
As a C# struct, a default parameterless constructor exists and initializes m_Offsets to float3.zero. -
You can construct it explicitly when creating component data:
new NetVertexMatchData { m_Offsets = new float3(x, y, z) }
Methods
- None.
The type is a plain data container and does not define methods. It implements IQueryTypeParameter purely as a marker for query usage in Unity.Entities.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;
// Create and assign the component to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
// Set an offset of 0.5 meters on X, 0 on Y, and -0.1 on Z
var matchData = new NetVertexMatchData { m_Offsets = new float3(0.5f, 0f, -0.1f) };
entityManager.AddComponentData(entity, matchData);
// Or within a system using Entities.ForEach (pseudo):
// Entities.WithAll<SomeNetComponent>().ForEach((Entity e, int entityInQueryIndex) =>
// {
// var md = new NetVertexMatchData { m_Offsets = new float3(1f, 0f, 0f) };
// EntityManager.SetComponentData(e, md);
// }).Schedule();
Notes:
- Include using Unity.Mathematics;
to access float3.
- Keep this component small and blittable for best ECS performance.