Game.UI.CustomName
Assembly: Assembly-CSharp (game assembly)
Namespace: Game.UI
Type: struct
Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
CustomName is an empty/tag ECS component used by the game to mark entities that have a custom name or participate in systems that handle custom naming. It is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to guarantee a non-zero size for serialization and interop, and implements IEmptySerializable to integrate with the Colossal.Serialization.Entities system. As a marker component, it contains no data — presence/absence on an entity is the meaningful information.
Fields
- (none)
This struct intentionally has no fields; its single-byte size is enforced by the StructLayout attribute so it can be serialized and stored by the underlying systems.
Properties
- (none)
Constructors
public CustomName()
Implicit default parameterless constructor provided by C# for value types. No custom initialization is required.
Methods
- (none)
There are no methods on this type. Behavior is driven by systems that query for the presence of this component.
Usage Example
// Mark an entity as having a custom name
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = /* obtain or create entity */;
// Add the tag component
entityManager.AddComponentData(entity, new CustomName());
// Later, check for the tag
bool hasCustomName = entityManager.HasComponent<CustomName>(entity);
// Query for all entities with the CustomName tag
EntityQuery query = entityManager.CreateEntityQuery(typeof(CustomName));
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
foreach (var e in entities)
{
// process named entities
}
}