Game.Tools.SelectionInfo
Assembly: Assembly-CSharp
Namespace: Game.Tools
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
SelectionInfo is a lightweight ECS component used by tooling systems to record what kind of selection is active and which area type the selection targets. It is intended for use with Unity's DOTS/ECS pattern: attach it to entities that represent current tool selection state or include it in queries to react to selection changes. The struct stores two small value fields (enums) and has no managed or heavy resources.
Fields
-
public SelectionType m_SelectionType
Stores the selection kind (e.g., single item, rectangle/box, multi-select, etc.). The concrete enum SelectionType is defined elsewhere in the codebase; use it to branch tool logic based on selection behavior. -
public AreaType m_AreaType
Indicates the area category the selection applies to (roads, zones, service areas, custom area types, etc.). AreaType is declared in Game.Areas and is used by systems that need to handle selection differently depending on area semantics.
Properties
None
This struct exposes plain public fields and does not define properties.
Constructors
public SelectionInfo()
Default parameterless (implicit) constructor provided by the struct. Initialize using object initializer syntax when creating or setting component data.
Example explicit initialization:
var sel = new SelectionInfo
{
m_SelectionType = SelectionType.Rectangle,
m_AreaType = AreaType.None
};
Methods
None
The struct declares no methods. It's a plain data container for use with ECS component APIs.
Usage Example
// Example: create an entity that holds the current selection state
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity selectionEntity = entityManager.CreateEntity(typeof(SelectionInfo));
// Initialize the selection component (replace enum members with actual ones from your code)
entityManager.SetComponentData(selectionEntity, new SelectionInfo
{
m_SelectionType = SelectionType.Rectangle,
m_AreaType = AreaType.None
});
// Example: reading selection data in a system
SelectionInfo info = entityManager.GetComponentData<SelectionInfo>(selectionEntity);
if (info.m_SelectionType == SelectionType.Rectangle)
{
// handle rectangle selection logic
}
Notes: - Because SelectionInfo implements IComponentData, prefer using EntityManager, SystemBase, or ISystem patterns to add/read/update it. - Implementing IQueryTypeParameter allows using this type in certain query helper patterns — consult your project's ECS query utilities for supported usage.