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
For more info about VehicleComponents and their states and LODs check VehicleComponent page.
isOnand has LOD set (
lodIndex >= 0) a piece of code is ran each frame to check if the
lodIndexof the component is less or equal to the
lodIndexis less or equal to
activeLodIndexthe component will be enabled, otherwise disabled.
ENABLEDbutton for that component. To fully disable a component use
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.
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.
VehicleComponentloads state from
StateSettings. This is only done once, on
VehicleComponent.Awake, so the
StateSettingscan also be thought of as initial vehicle component state settings.