Skip to content

Game.Net.ConnectedEdge

Assembly: Assembly-CSharp (likely Assembly-CSharp.dll)
Namespace: Game.Net

Type: struct

Base: Unity.Entities.IBufferElementData, System.IEquatable, Colossal.Serialization.Entities.IEmptySerializable

Summary: Represents a single buffer element that references a network edge Entity. Marked with InternalBufferCapacity(4) so DynamicBuffer will be preallocated with a small internal capacity. Equality and hash code are based solely on the referenced Entity. The struct is intended for use in Unity DOTS/ECS dynamic buffers to track edges connected to a node or other network element.


Fields

  • public Unity.Entities.Entity m_Edge Holds the Entity that represents the connected edge. This is the value used for equality and hashing.

Properties

  • None. This struct exposes a single public field and no properties.

Constructors

  • public ConnectedEdge(Unity.Entities.Entity edge) Creates a ConnectedEdge that references the given edge entity. Simply assigns the provided Entity to m_Edge.

Methods

  • public bool Equals(ConnectedEdge other)
    Compares this instance to another ConnectedEdge by comparing their m_Edge values (Entity equality).

  • public override int GetHashCode()
    Returns the hash code of the underlying Entity (m_Edge.GetHashCode()).

Usage Example

// Example: attach a DynamicBuffer<ConnectedEdge> to a node entity and add an edge reference
var nodeEntity = /* some entity representing a node */;
var edgeEntity = /* some entity representing an edge */;

// Ensure the buffer exists and add a connected edge
var buffer = entityManager.GetBuffer<ConnectedEdge>(nodeEntity);
buffer.Add(new ConnectedEdge(edgeEntity));

// Check for existence (simple example)
bool contains = false;
foreach (var ce in buffer)
{
    if (ce.Equals(new ConnectedEdge(edgeEntity)))
    {
        contains = true;
        break;
    }
}