Game.Net.ArrowPosition
Assembly:
{{ Likely defined in the game assembly (Assembly-CSharp) or a game-specific assembly. This struct is part of the runtime game code used by Cities: Skylines 2; modders should reference the same assembly the game exposes for ECS types. }}
Namespace: Game.Net
Type: struct
Base: System.ValueType (struct), Unity.Entities.IBufferElementData, Colossal.Serialization.Entities.IEmptySerializable
Summary: ArrowPosition is a Unity DOTS buffer element used to represent a single arrow marker (position, direction and display flags) in the game networking/visualization code. The struct is marked with [InternalBufferCapacity(0)] indicating it is stored as a truly dynamic buffer (no inline capacity). It uses Unity.Mathematics.float3 for compact SIMD-friendly storage and implements IEmptySerializable so it can participate in the game's custom serialization infrastructure.
Fields
-
public Unity.Mathematics.float3 m_Position
Stores the world position of the arrow. Used to place the arrow marker in 3D space. -
public Unity.Mathematics.float3 m_Direction
Normalized (or directional) vector indicating the arrow's facing direction. Used for orienting arrow visuals. -
public System.Single m_MaxScale
Maximum scale (float) for the arrow visuals. Controls size/scale when rendering. -
public System.Boolean m_IsTrack
Boolean flag indicating whether this arrow is associated with a track (rail/road lane/etc.) or not. Used to choose rendering or behavioral logic. -
public System.Boolean m_IsUnderground
Boolean flag indicating whether this arrow is placed underground. Used to adjust rendering or visibility rules.
Properties
- None (this type exposes public fields only).
{{ This struct is a plain data carrier intended for use as a DynamicBuffer element; it doesn't expose encapsulating properties. }}
Constructors
- Default (implicit) constructor
{{ As a struct, ArrowPosition uses the compiler-provided default constructor which zero-initializes fields. Create instances with assignment or object initializer syntax to set desired values. }}
Methods
- None (no methods declared)
{{ This type is a simple POD (plain old data) container. Any logic operating on ArrowPosition instances is provided elsewhere (systems, jobs, or utility methods). }}
Attributes
[InternalBufferCapacity(0)]
{{ Declares that the dynamic buffer has no embedded fixed capacity in the entity; all elements are stored in heap-managed buffer memory. This is appropriate when buffer size is highly variable. }}
Serialization
- Implements
IEmptySerializable
from Colossal.Serialization.Entities
{{ This marker interface integrates the struct into the game's custom serialization pipeline, allowing ArrowPosition buffers to be serialized/deserialized by the Colossal serialization systems used by Cities: Skylines 2. }}
Usage Example
// Example: adding an arrow to an entity's DynamicBuffer in a system
using Unity.Entities;
using Unity.Mathematics;
using Game.Net;
public partial struct ArrowSystem : ISystem
{
public void OnCreate(ref SystemState state)
{
// Ensure the entity archetype has a dynamic buffer for ArrowPosition
}
public void OnUpdate(ref SystemState state)
{
var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
// Assume `entity` is an Entity that should hold arrow positions
Entity entity = /* obtained elsewhere */ Entity.Null;
// Ensure buffer exists on the entity
if (!state.EntityManager.HasComponent<ArrowPosition>(entity))
{
ecb.AddBuffer<ArrowPosition>(entity);
ecb.Playback(state.EntityManager);
}
var buffer = state.EntityManager.GetBuffer<ArrowPosition>(entity);
buffer.Add(new ArrowPosition {
m_Position = new float3(10.0f, 0.0f, 20.0f),
m_Direction = math.normalize(new float3(1f, 0f, 0f)),
m_MaxScale = 1.5f,
m_IsTrack = false,
m_IsUnderground = false
});
ecb.Dispose();
}
}
Notes:
- Use DynamicBuffer