Game.IndustrialCompanyData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Summary:
IndustrialCompanyData is an empty/tag component used with Unity's ECS (IComponentData) to mark entities that represent industrial companies in the game. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure it occupies at least one byte (useful for native interop or runtime requirements) and also implements IQueryTypeParameter to allow use in certain query contexts.
Fields
- (none)
This struct contains no instance fields; it is used as a tag component.
Properties
- (none)
No properties are defined.
Constructors
public IndustrialCompanyData()
Structs in C# have an implicit parameterless constructor. No custom constructors are defined.
Methods
- (none)
No methods are defined on this type.
Usage Example
// Add the tag to an entity using EntityManager
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new Game.Prefabs.IndustrialCompanyData());
// Or with an EntityArchetype when creating multiple entities
var archetype = entityManager.CreateArchetype(
typeof(Game.Prefabs.IndustrialCompanyData),
typeof(Translation),
typeof(RenderMesh)
);
var companyEntity = entityManager.CreateEntity(archetype);
// Query entities that have the tag
var query = entityManager.CreateEntityQuery(typeof(Game.Prefabs.IndustrialCompanyData));
using (var entities = query.ToEntityArray(Allocator.TempJob))
{
foreach (var e in entities)
{
// handle industrial company entity
}
}
Additional notes: - Because the struct is effectively a tag (no data fields), it is efficient to use for marking entities. - The StructLayout(Size = 1) attribute ensures the type is not treated as a zero-sized type by some runtimes or interop layers.