Game.Net.SubFlow
Assembly:
(unknown — likely the game's main assembly, e.g. Game.dll)
Namespace: Game.Net
Type: struct
Base: IBufferElementData, IEmptySerializable
Summary:
SubFlow is a small ECS buffer element used by the game to store a single signed byte value per buffer element. The struct is annotated with InternalBufferCapacity(16), which sets the inline capacity for the dynamic buffer (i.e., how many elements fit in the chunk before additional heap allocation). It is intended to be used as an element type for Unity.Entities DynamicBuffer
Fields
-
public sbyte m_Value
A signed 8-bit integer value stored by this buffer element. Range: -128 to 127. Used to hold a compact numeric value or small flag/id per buffer entry. Since it's a blittable primitive, it is cheap to copy and suitable for storage in ECS buffers. -
[InternalBufferCapacity(16)]
(type-level attribute) Sets the default inline buffer capacity for DynamicBufferon an entity to 16 elements. This affects memory layout and performance: buffer elements up to this capacity are stored in the chunk (fast access), and elements beyond it require additional heap allocation. -
implements IBufferElementData
Marks this struct as a valid element type for DynamicBufferwithin Unity's ECS. -
implements IEmptySerializable
Game-specific marker interface (from Colossal.Serialization.Entities) used by the game's serialization system to mark types for special handling during save/load or network serialization.
Properties
- (none) This struct exposes no properties; it only contains the public field m_Value.
Constructors
-
public SubFlow()
(implicit default struct constructor) Structs have a default parameterless constructor that initializes m_Value to 0. -
public SubFlow(sbyte value)
You can add a simple convenience constructor if needed:
public SubFlow(sbyte value)
{
m_Value = value;
}
Methods
- (none)
There are no methods defined on this type. All typical operations are reading/writing the m_Value field and manipulating the DynamicBuffer
container.
Usage Example
Example showing how to create an entity with a SubFlow buffer and add/read elements:
// create an entity archetype that contains a dynamic buffer of SubFlow
var archetype = EntityManager.CreateArchetype(typeof(SubFlow));
Entity entity = EntityManager.CreateEntity(archetype);
// get the dynamic buffer and add elements
DynamicBuffer<SubFlow> buffer = EntityManager.GetBuffer<SubFlow>(entity);
buffer.Add(new SubFlow { m_Value = 1 });
buffer.Add(new SubFlow { m_Value = -5 });
// read elements
for (int i = 0; i < buffer.Length; i++)
{
sbyte value = buffer[i].m_Value;
// use value...
}
// convenience constructor usage (if added)
buffer.Add(new SubFlow((sbyte)10));
Tips for modders: - Because m_Value is an sbyte, be careful when interop or serializing to formats that don't support signed bytes directly — cast to/from int if needed. - Choose InternalBufferCapacity to balance chunk memory usage vs. heap allocations. A small struct like SubFlow is efficient, but many buffer elements per entity can increase memory pressure. - As a blittable value type implementing IBufferElementData, SubFlow is efficient for jobs and Burst compilation when used in Job/Entity queries.