Skip to content

Game.Prefabs.NetSectionData

Assembly: Game (inferred)
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
NetSectionData is an empty marker/tag component used by the ECS to mark entities (likely net/prefab-related sections). It is declared with [StructLayout(LayoutKind.Sequential, Size = 1)] so the struct occupies 1 byte — this avoids the pitfalls of zero-sized empty structs in native containers and ensures predictable memory layout when used in entity/component storage or native interop. As a value-type component implementing IComponentData and IQueryTypeParameter, it is intended for use in queries and archetypes as a flag rather than carrying payload data.


Fields

  • (none)
    This struct contains no managed fields. The explicit StructLayout(Size = 1) gives it a non-zero size for storage.

Properties

  • (none)

Constructors

  • public NetSectionData() (implicit default)
    Structs get a default parameterless constructor that zero-initializes the instance. No custom constructors are defined.

Methods

  • (none)

Usage Example

// Add the marker component to an existing entity:
entityManager.AddComponent<NetSectionData>(entity);

// Create an entity with the marker in its archetype:
var archetype = entityManager.CreateArchetype(typeof(NetSectionData));
var entity = entityManager.CreateEntity(archetype);

// Query entities that have the marker:
Entities.WithAll<NetSectionData>().ForEach((Entity e) =>
{
    // handle net section marked entities
}).Schedule();

Notes: - Use this component as a tag to identify or filter entities related to net sections/prefabs. - The 1-byte layout is deliberate to ensure the struct is storable in ECS containers and to avoid special-case handling of truly empty structs.