Game.Prefabs.InfoviewVehicleData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Component data used to represent display information for a vehicle in an infoview/overlay. Stores the vehicle's type (category) and a color used for visualization (RGBA). Because it implements IComponentData it can be attached to ECS entities; IQueryTypeParameter allows it to be used directly in queries/iterators in the Entities API.
Fields
-
public VehicleType m_Type
Represents the vehicle's classification/type (enum). Used to determine icon, behavior grouping or filtering in UI overlays and lists. The exact enum values are defined elsewhere (VehicleType in the game code). -
public float4 m_Color
RGBA color used for visualizing this vehicle in the infoview. Components are usually in 0..1 range (r, g, b, a). Uses Unity.Mathematics.float4 for blittable storage appropriate for ECS.
Properties
- None
Constructors
public InfoviewVehicleData()
Struct has the default implicit constructor. Initialize fields inline or via object initializer when creating an instance.
Methods
- None
Usage Example
// Create a new component instance and assign fields
var info = new InfoviewVehicleData {
m_Type = VehicleType.Bus,
m_Color = new float4(0.1f, 0.6f, 0.9f, 1f) // r,g,b,a
};
// Converting from UnityEngine.Color:
UnityEngine.Color unityColor = UnityEngine.Color.cyan;
info.m_Color = new float4(unityColor.r, unityColor.g, unityColor.b, unityColor.a);
// Add to an entity (example using EntityManager)
entityManager.AddComponentData(someEntity, info);
// Using in a System query (IQueryTypeParameter support)
// Example pseudo-code showing usage in Entities.ForEach or System API:
Entities
.WithAll<SomeOtherComponent>()
.ForEach((Entity e, ref InfoviewVehicleData v) => {
// use v.m_Type and v.m_Color here
}).Schedule();
{{ This struct is small and blittable (uses primitive and Unity.Mathematics types), making it cheap to store on entities. Use float4 when you need predictable layout and performance in ECS; convert from UnityEngine.Color when interacting with non-ECS code. If you add more fields later, keep them blittable to remain compatible with IComponentData. }}