Game.Prefabs.NetCompositionArea
Assembly:
Assembly-CSharp (typical game runtime assembly; actual assembly may vary)
Namespace:
Game.Prefabs
Type:
public struct NetCompositionArea
Base:
Implements Unity.Entities.IBufferElementData
Summary:
NetCompositionArea is a lightweight buffer element used by the game's ECS to describe an area related to net (road/rail/etc.) composition. It carries flags and geometric information (position and width) plus a separate "snap" position/width used for alignment or snapping behavior. The struct is annotated with [InternalBufferCapacity(0)], meaning the dynamic buffer stores no inline elements on the entity — elements are allocated externally as needed.
Fields
-
public NetAreaFlags m_Flags
Flags describing properties or behavior of the area. NetAreaFlags is expected to be an enum (not shown here) that encodes boolean/state bits relevant to network composition (for example: active, snapped, special type markers). -
public float3 m_Position
The world (or local, depending on context) position of the area center used for composition calculations. Uses Unity.Mathematics.float3. -
public float m_Width
The width (radius/half-width, depending on convention) of the composition area. -
public float3 m_SnapPosition
An alternate position used for snapping/aligning the area to other geometry or grid constraints. -
public float m_SnapWidth
An alternate width used when the area is in a snapped state or when calculating snap-specific composition.
Properties
- This type defines no C# properties. It is a plain buffer element (fields only).
Constructors
public NetCompositionArea()
No explicit constructors are defined; the default struct constructor (zero-initialization) applies. When creating instances, initialize fields explicitly if non-zero/default values are required.
Methods
- No methods are defined on this struct. It is a data container only.
Usage Example
// Example inside a ComponentSystem or SystemBase:
protected override void OnUpdate()
{
Entities.ForEach((Entity entity, int entityInQueryIndex, ref SomeComponent comp) =>
{
// Ensure the entity has a dynamic buffer for NetCompositionArea
var buffer = EntityManager.HasComponent<NetCompositionArea>(entity)
? EntityManager.GetBuffer<NetCompositionArea>(entity)
: EntityManager.AddBuffer<NetCompositionArea>(entity);
// Add a composition area
buffer.Add(new NetCompositionArea
{
m_Flags = NetAreaFlags.None, // example enum value
m_Position = new Unity.Mathematics.float3(10f, 0f, 20f),
m_Width = 5f,
m_SnapPosition = new Unity.Mathematics.float3(10f, 0f, 20f),
m_SnapWidth = 5f
});
}).Run();
}
Notes: - Because of [InternalBufferCapacity(0)], the buffer initially stores no inline elements on the entity; the underlying storage will be allocated as needed. - Initialize fields explicitly when creating instances to avoid relying on default zeros if other semantics are intended. - Consult the definition of NetAreaFlags to choose appropriate flag values.