Class StateSettings
Asset holding the per-component enabled state and the LOD distance bands for a vehicle. One asset is usually shared by several vehicles, so it doubles as a performance profile.
Namespace: NWH.VehiclePhysics2
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
[CreateAssetMenu(fileName = "NWH Vehicle Physics 2", menuName = "NWH/Vehicle Physics 2/State Settings", order = 1)]
public class StateSettings : ScriptableObject
Remarks
LOD 0 is the highest detail and the shortest distance; higher indices drop non-essential effects and sounds. Definitions are read on Awake(), so edits only reach vehicles enabled after the change.
Fields
LODs
LOD entries, ordered ascending by distance from 0 (closest, highest detail). Each holds the distance at which the vehicle switches to that detail level.
Declaration
public List<LOD> LODs
Field Value
| Type | Description |
|---|---|
| List<LOD> |
definitions
State definition per VehicleComponent: enabled flag and LOD level. Populated from the VehicleComponent types found in the project.
Declaration
public List<StateDefinition> definitions
Field Value
| Type | Description |
|---|---|
| List<StateDefinition> |
Properties
LODCount
Number of LOD levels.
Declaration
public int LODCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
GetDefinition(string)
Retrieves the StateDefinition for a specific VehicleComponent type.
Declaration
public StateDefinition GetDefinition(string fullComponentTypeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fullComponentTypeName | The fully qualified type name of the component (e.g., "NWH.VehiclePhysics2.Sound.SoundManager"). |
Returns
| Type | Description |
|---|---|
| StateDefinition | The StateDefinition for the specified component, or null if not found. |
Reload()
Rescans all assemblies for VehicleComponent types, adding definitions for new ones and dropping definitions whose type is gone. Also reachable from the editor Refresh button.
Declaration
public void Reload()
ValidateLODOrder()
Validates that LOD distances are in ascending order (lowest to highest). Logs a warning if the order is incorrect.
Declaration
public bool ValidateLODOrder()
Returns
| Type | Description |
|---|---|
| bool | True if LOD distances are correctly ordered, false otherwise. |
ValidateLODOrder(bool)
Validates that all LOD references are assigned and their distances are in ascending order.
Declaration
public bool ValidateLODOrder(bool logWarnings)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | logWarnings | Whether to log a warning when validation fails. |
Returns
| Type | Description |
|---|---|
| bool | True if all references are assigned and distances are correctly ordered, false otherwise. |