Creating Vehicle Parts Presets
Last updated
Last updated
CustomVehicleController component can use an instance of a VehiclePartsPresetSO to work.
VehiclePartsPresetSO is a scriptable object that holds references to vehicle parts that make up a vehicle. Every part except Nitrous and Force Induction (sub-part of the engine) is required.
Make sure the "Use Preset" toggle is turned on (you can change the toggle value either in the inspector or editor window).
Go to Preset Settings in the editor window.
Enter a preset name and click the "Create New Preset Asset" button.
Presets are saved at "CustomVehicleController/VehicleController/VehicleParts/Presets".
Alternatively, you can create an instance by clicking RMB in the project folder of your choice -> Create -> CustomVehicleController -> VehicleParts -> VehiclePartsPreset.
If the GameObject with CustomVehicleController script is selected, the newly created preset instance will be assigned to it.
In this very same foldout you can select every vehicle part you want to make up a preset.
Alternatively, while the instance of vehicle preset is selected, changing object field values from the individual parts editors updates the used part instance.
However, as expected, if the same scriptable object is assigned to multiple scripts, changing its values affects every SO user. Because of this, upgrades to individual vehicles are not possible.
For this reason, a new approach is required. Learn to use customizable parts sets and update them at runtime here.