Game.Prefabs.EditorContainerData
Assembly: Assembly-CSharp (game code / mod assembly)
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
EditorContainerData is an empty "tag" component (IComponentData) used to mark entities that represent editor/container prefabs. The struct is intentionally empty and decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to force a non-zero size (1 byte). This can help avoid issues with zero-sized types in certain interop/serialization or engine code paths. Because it implements IQueryTypeParameter, it can be used directly in EntityQueries / LINQ-style queries as a filter/tag.
Fields
- None.
This struct defines no instance fields; it is used purely as a marker/tag. The StructLayout attribute sets the size to 1 byte, so no additional managed state is present.
Properties
- None.
No properties are exposed.
Constructors
- Default struct constructor (implicit).
There is no explicit constructor defined. Use the default parameterless struct initialization (new EditorContainerData()) when adding it as component data.
Methods
- None.
No methods are defined on this type.
Usage Example
// Example: add the tag during GameObject -> Entity conversion
using Unity.Entities;
using Game.Prefabs;
public class EditorContainerAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
// Attach the marker component to the converted entity
dstManager.AddComponentData(entity, new EditorContainerData());
}
}
// Example: query for entities with the tag in a SystemBase
public partial class HandleEditorContainersSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<EditorContainerData>()
.ForEach((Entity entity) =>
{
// Process editor/container entities here
})
.ScheduleParallel();
}
}
Notes: - Because this is a marker/tag component, it is typically used only for filtering queries or identifying entities; it carries no payload data. - The StructLayout(Size = 1) attribute ensures the struct is not treated as zero-sized which can be important when interacting with native/interop code or when deterministic layout is required.