Game.Prefabs.VehicleMarkerData
Assembly:
Likely Assembly-CSharp or the mod/game assembly that contains Game.Prefabs types. (If you build a mod, this struct will be compiled into your mod assembly.)
Namespace: Game.Prefabs
Type: struct (value type)
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A simple ECS component used as a marker to tag entities with a vehicle type. This component holds a VehicleType value that identifies what kind of vehicle the entity represents (e.g., car, bus, tram — actual enum values are defined in the game's VehicleType declaration). Because it implements IComponentData it can be attached to entities and used in DOTS/ECS queries; implementing IQueryTypeParameter allows usage in certain query-building scenarios.
Fields
public VehicleType m_VehicleType
Holds the vehicle category for the marked entity. VehicleType is an enum defined elsewhere in the codebase; this field is used by systems that need to filter, render, or otherwise process entities by vehicle type.
Properties
- This type has no properties. It exposes a single public field.
Constructors
public VehicleMarkerData()
The default value-type constructor is used; when added as a component the field will be default-initialized unless you explicitly set m_VehicleType.
Methods
- This struct declares no methods.
Usage Example
// Add the component to an entity (EntityManager usage)
var marker = new VehicleMarkerData { m_VehicleType = VehicleType.Car };
entityManager.AddComponentData(entity, marker);
// Create a query that selects entities with VehicleMarkerData
var query = entityManager.CreateEntityQuery(typeof(VehicleMarkerData));
using (var entities = query.ToEntityArray(Unity.Collections.Allocator.TempJob))
{
foreach (var e in entities)
{
var vm = entityManager.GetComponentData<VehicleMarkerData>(e);
// Use vm.m_VehicleType to drive logic (rendering, routing, filtering, etc.)
}
}
// Example inside a system using Entities.ForEach (pseudo-code)
// Entities.ForEach((ref VehicleMarkerData marker) => {
// if (marker.m_VehicleType == VehicleType.Bus) { /* ... */ }
// }).Schedule();
Notes: - Because this is a plain IComponentData struct, it is blittable and cheap to store in archetypes. - Use this marker to tag vehicle-related entities so systems can efficiently query and process them by type.