Skip to content

Game.Net.Standalone

Assembly: Assembly-CSharp
Namespace: Game.Net

Type: struct

Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable)

Summary: Standalone is an empty/tag ECS component used by the game's networking code to mark entities as "standalone" network objects. It is defined with a fixed layout and size of 1 byte via StructLayout so it can be safely serialized/deserialized by Colossal's serialization system while remaining memory-efficient as a marker type. Being an IComponentData makes it usable in Unity.Entities queries and systems; IQueryTypeParameter allows it to be used directly in query type parameter lists; IEmptySerializable indicates custom (empty) serialization behavior handled by the Colossal serialization pipeline.


Fields

  • None
    This struct declares no instance fields. It is an empty/tag component. The StructLayout attribute ([StructLayout(LayoutKind.Sequential, Size = 1)]) forces a size of 1 byte for serialization/interop even though there are no managed fields.

Properties

  • None
    There are no properties. Use the type purely as a tag component.

Constructors

  • Implicit default constructor
    There is no explicit constructor declared. As a value type, Standalone has the default parameterless constructor (all-zero memory), which is sufficient for use as a tag component.

Methods

  • None
    No methods are declared on this struct. Any serialization or runtime behavior is provided by the implemented interfaces and external systems (Unity.Entities and Colossal.Serialization).

Usage Example

// Add the tag to an entity
var entity = EntityManager.CreateEntity(typeof(Game.Net.Standalone));

// Or add to an existing entity
EntityManager.AddComponentData(entity, new Game.Net.Standalone());

// Query for entities that have the Standalone tag in a SystemBase
public partial class StandaloneProcessingSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .WithAll<Game.Net.Standalone>()
            .ForEach((Entity e /*, in OtherData d */) =>
            {
                // process standalone networked entity
            })
            .Schedule();
    }
}

{{ Notes and tips: - Because Standalone is an empty/tag component, use it for classification (e.g., to mark entities that should be treated differently by networking systems). - The StructLayout(Size = 1) is important for the game's custom serializer (Colossal.Serialization) which expects a non-zero size for serializable types; removing it can break serialization or interop assumptions. - As an IQueryTypeParameter, this type can be used directly in Queries/WithAll calls for efficient filtering. }}