Class ExhaustFlash
Controls exhaust flash effects that create brief, bright flame bursts from exhaust pipes during engine operation, gear shifts, and rev limiter engagement.
Inherited Members
Namespace: NWH.VehiclePhysics2.Effects
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class ExhaustFlash : Effect
Remarks
Writes material emission properties, so the flash materials need an emission-enabled shader. Flashes are event driven: the rev limiter and gear shift roll flashChance, while NOSModule and direct Flash() calls fire unconditionally and are bounded only by flashDuration. The rolled path is skipped while the engine is off, cranking, or below MinFlashRpmPercent, unless flashWhenEngineOff is set.
Fields
flashChance
Probability that a flash fires on each rev-limiter or shift event (0-1 range). Higher values create more frequent flashing effects.
Declaration
public float flashChance
Field Value
| Type | Description |
|---|---|
| float |
Remarks
0.05-0.1 is occasional and realistic for most engines, 0.15-0.3 suits a performance car, 0.4-0.8 suits a race car or a backfiring engine.
flashDuration
Duration of each flash effect in seconds. Controls how long the flash remains visible before fading out.
Declaration
public float flashDuration
Field Value
| Type | Description |
|---|---|
| float |
Remarks
0.02-0.05 s resembles a real exhaust flame, 0.08-0.15 s is easier to see as gameplay feedback, 0.2 s and up is showy rather than realistic.
flashLights
Optional Unity Light components that will flash in sync with the exhaust flash effect. Used to illuminate surroundings during flash events.
Declaration
public List<Light> flashLights
Field Value
| Type | Description |
|---|---|
| List<Light> |
Remarks
Keep range and intensity moderate; these switch on and off at the flash rate.
flashOnRevLimiter
Enable flashing when the engine hits the rev limiter. Makes over-revving visible through exhaust flashes.
Declaration
public bool flashOnRevLimiter
Field Value
| Type | Description |
|---|---|
| bool |
flashOnShift
Enable flashing during gear shifts, particularly with aggressive shift patterns. Adds visual feedback for transmission events.
Declaration
public bool flashOnShift
Field Value
| Type | Description |
|---|---|
| bool |
flashTextures
Textures representing exhaust flash. If multiple textures are assigned, a random texture will be chosen for each flash.
Declaration
[Tooltip("Textures representing exhaust flash. If multiple are assigned a random texture will be chosen for each flash.")]
public List<Texture2D> flashTextures
Field Value
| Type | Description |
|---|---|
| List<Texture2D> |
flashWhenEngineOff
Allow flashes while the engine is off/idling. Off by default so a dead engine shuffling D/N/R (automatic N to R and back) does not spam flashes. Matches the exhaust pop guard.
Declaration
public bool flashWhenEngineOff
Field Value
| Type | Description |
|---|---|
| bool |
meshRenderers
Mesh renderer(s) for the exhaust flash meshes.
Declaration
[Tooltip("Mesh renderer(s) for the exhaust flash meshes.")]
public List<MeshRenderer> meshRenderers
Field Value
| Type | Description |
|---|---|
| List<MeshRenderer> |
onFlash
Unity event triggered each time an exhaust flash occurs. Use this to synchronize additional effects like camera shake, sound, or particle systems.
Declaration
public UnityEvent onFlash
Field Value
| Type | Description |
|---|---|
| UnityEvent |
Remarks
Fires as the flash begins, before the visual runs out its flashDuration.
Methods
Flash()
Triggers a single flash immediately and invokes the onFlash event.
Declaration
public void Flash()
Remarks
Persistent UnityEvent listeners bind by name and argument count, so this no-argument form is what pre-14.0 scene and prefab wiring resolves to.
Flash(bool)
Triggers a single flash immediately.
Declaration
public void Flash(bool triggerEvent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | triggerEvent | Whether to invoke the onFlash event. |
FlashWithChance()
Rolls flashChance and flashes if it passes, invoking the onFlash event. Event-driven entry (rev limiter / shift); skips when the engine isn't actually firing unless flashWhenEngineOff.
Declaration
public void FlashWithChance()
FlashWithChance(bool, float)
Rolls the given chance and flashes if it passes.
Declaration
public void FlashWithChance(bool triggerEvent, float chance)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | triggerEvent | Whether to invoke the onFlash event. |
| float | chance | Flash probability in the 0-1 range. |
VC_Disable(bool)
Disables the component and stops its updates.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True when called by a parent ManagerVehicleComponent fan-out or the VehicleController enable/disable loop. The LOD system passes false. |
Returns
| Type | Description |
|---|---|
| bool | True if successfully disabled, false otherwise |
Overrides
Remarks
Refused on a component that is not initialized. Records whether the call came from a parent, which is what VC_Enable checks before a bulk re-enable.
VC_Enable(bool)
Enables the component and starts its updates.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True when called by a parent ManagerVehicleComponent fan-out or the VehicleController enable/disable loop. The LOD system passes false. |
Returns
| Type | Description |
|---|---|
| bool | True if successfully enabled, false otherwise |
Overrides
Remarks
Initializes the component first if it is not initialized yet. A parent bulk enable is refused unless the last disable also came from a parent, so it cannot resurrect a component turned off by LOD, by a script, or disabled in StateSettings.
VC_SetDefaults()
Writes default values into every serialized field, and may pull default assets from Resources. Runs on vehicle reset and when the component is first added.
Declaration
public override void VC_SetDefaults()