Game.EndFrameBarrier
Assembly:
Assembly-CSharp (common runtime assembly for Cities: Skylines 2 mods; the source file provided is located under Game\Net and uses the Game.Net namespace)
Namespace:
Game.Net
Type:
struct (value type)
Base:
Implements:
- Unity.Entities.IComponentData
- Unity.Entities.IQueryTypeParameter
- Colossal.Serialization.Entities.IEmptySerializable
Summary:
The provided source defines Game.Net.TramTrack as a minimal/empty ECS component (a tag component) used in the Unity.Entities world. It carries no data other than occupying a single byte (StructLayout with Size = 1) so it can be used as a marker/tag to identify entities related to tram tracks. The IEmptySerializable marker indicates custom/optimized serialization behavior used by Colossal's serialization utilities; IQueryTypeParameter allows it to be used directly in queries as a parameter type.
Fields
-
private System.Diagnostics.Stopwatch m_Stopwatch
This field is not present in the provided TramTrack struct. TramTrack defines no private fields. It is intentionally empty (only layout size enforced by the StructLayout attribute). -
private Unity.Jobs.JobHandle <producerHandle>k__BackingField
This field is not present in the provided TramTrack struct. There are no backing fields or job handles — TramTrack is a zero-data tag component.
Properties
public Unity.Jobs.JobHandle producerHandle { get; private set }
Not applicable for TramTrack. The struct exposes no properties. It only implements marker interfaces and relies on being an empty IComponentData.
Constructors
public EndFrameBarrier()
TramTrack has no explicit constructors. As a value type (struct) it has the implicit default parameterless constructor. The StructLayout attribute enforces a size of 1 byte for layout/serialization purposes.
Methods
protected virtual OnCreate() : System.Void
TramTrack declares no methods. It is intended solely as an empty/tag IComponentData.
Usage Example
using Unity.Entities;
using Game.Net;
// create an entity with the TramTrack tag
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
EntityArchetype archetype = entityManager.CreateArchetype(typeof(TramTrack));
Entity tramTrackEntity = entityManager.CreateEntity(archetype);
// or add the tag to an existing entity
Entity someEntity = /* existing entity */;
entityManager.AddComponent<TramTrack>(someEntity);
// query for entities that have the TramTrack tag
var query = entityManager.CreateEntityQuery(typeof(TramTrack));
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
// process tram-track-tagged entities
}
Additional notes: - The attribute [StructLayout(LayoutKind.Sequential, Size = 1)] ensures the struct has a non-zero size (1 byte) which can be important for some serialization or native interop paths; it also stabilizes memory layout. - IEmptySerializable is part of Colossal.Serialization.Entities and typically indicates that the component participates in a custom serialization path optimized for empty/tag components. - Because TramTrack is empty, it should be used only as a tag/marker; any data associated with tram tracks should be stored in separate components.