0 votes
by
I'd like to save the vehicles settings to a serialized text file for easy editing outside the game. The API looks like it locks out those settings for community edition. I'd just like to be able to dynamically load different profiles as needed.

1 Answer

0 votes
by
selected by
 
Best answer

Settings are exposed as standard public properties in VPVehicleController, and settings classes are decorated as [Serializable]. You may access these properties as with any other standard property in Unity and serialize / deserialize them using any of the regular methods available in Unity / C#.

Reference: properties exposed in VPVehicleController

Note that some of these settings include references to other GameObjects in the vehicle. For example this is the case of the VPAxle class, which includes references to the VPWheelCollider components. Serializing the VPAxle class stores the references but not the actual settings of the wheel colliders (which also include references to the visual GameObjects of the wheel).

A good practice is defining a subset of properties that may be configured outside the game, leaving the other properties as per-design in the vehicle. Then save/load those properties only from an external file.

by
Ah that works. But when I try to set one of the variables, the whole object becomes null. If I edit the underlying car, do I need to run a update function?
by
Never seen that problem before. Variables in VPP components work as in Unity standard components. That's probably an issue in your code.
...