StateSettings
is a ScriptableObject
containing info about LODs and VehicleComponent
states. The aim of StateSettings
is to prevent having to set the state of each VehicleComponent
on each VehicleController
individually.
For more info about VehicleComponents and their states and LODs check VehicleComponent page.
isOn
and has LOD set (lodIndex >= 0
) a piece of code is ran each frame to check if the lodIndex
of the component is less or equal to the VehicleController
's activeLodIndex
. lodIndex
is less or equal to activeLodIndex
the component will be enabled, otherwise disabled.ENABLED
button for that component. To fully disable a component use ON
button (isOn
).IsAwake == false
) last lod in the LODs list is forced no matter the distance. This is the best way to handle inactive, parked vehicles that still need to have a part of functionality enabled.
Setting VehicleController.IsAwake
to false will force last LOD, no matter the distance, for the duration the vehicle is asleep. Therefore it is a good idea to allocated the last lod as a vehicle inactive LOD.
VehicleComponent
loads state from StateSettings
. This is only done once, on VehicleComponent.Awake
, so the StateSettings
can also be thought of as initial vehicle component state settings.