Class MetricsModuleWrapper
MonoBehaviour wrapper for the Metrics module.
Namespace: NWH.VehiclePhysics2.Modules.Metrics
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
[DisallowMultipleComponent]
public class MetricsModuleWrapper : ModuleWrapper
Remarks
Required component wrapper that allows the MetricsModule to be attached to a GameObject with a VehicleController. The wrapper handles Unity's MonoBehaviour lifecycle and serialization while delegating the actual metrics tracking to the contained module.
Add this component to a vehicle GameObject through: - Unity Editor: Add Component > NWH > Vehicle Physics 2 > Modules > Metrics Module - Script: gameObject.AddComponent<MetricsModuleWrapper>()
The module can be accessed at runtime through the module field to read metric values, reset counters, or integrate with UI and achievement systems.
Fields
module
The MetricsModule instance managed by this wrapper.
Declaration
public MetricsModule module
Field Value
| Type | Description |
|---|---|
| MetricsModule |
Remarks
Access this field to read vehicle metrics, reset counters, or monitor performance statistics. All tracked metrics are accessible through this module's public Metric fields.
Methods
GetModule()
Returns the contained MetricsModule as a VehicleComponent.
Declaration
public override VehicleComponent GetModule()
Returns
| Type | Description |
|---|---|
| VehicleComponent | The MetricsModule instance cast to VehicleComponent. |
Overrides
SetModule(VehicleComponent)
Sets the contained module from a VehicleComponent reference.
Declaration
public override void SetModule(VehicleComponent module)
Parameters
| Type | Name | Description |
|---|---|---|
| VehicleComponent | module | The VehicleComponent to set, must be a MetricsModule instance. |