Loadout

It's far easier to use the Loadout prefab provided in the kits than it is to build the entire loadout menu from scratch, as the menu is quite complex and involves a lot of different UI elements.

As such, this documentation is going to cover modifying and setting up the loadout menu rather than building a new one.

Creating A Loadout Menu

To create a new loadout menu, drag the Loadout prefab into the scene.

This brings in the entire loadout menu which you can now modify to your liking.

Adding Your Vehicles And Modules

To add your own vehicles and modules to a loadout menu, create a new Loadout Items object:

  1. Create a new game object and add a Loadout Items component

  2. Add vehicle prefabs you want to appear in the loadout in the Vehicles list

  3. Add module prefabs that you want to appear in the loadout in the Modules list

  4. Drag the object into the Project tab to create a new prefab

  5. Drag the prefab into the Starting Items field in the inspector of the Loadout Manager component on the loadout prefab

Saving/Loading Loadouts

The Loadout prefab comes with a Loadout Data Manager JSON component that saves and loads loadout data to a file at the Application.persistentDataPath in JSON format.

If you wish to create your own loadout save/load script:

  1. Create a new script that extends the Loadout Data Manager base class

  2. Add your own code for saving/loading

  3. Add your component to the loadout menu and drag it into the Loadout Data Manager field in the inspector of the Loadout Manager component

Loadout Slots

The loadout enables you to load and save multiple loadouts in slots.

To create multiple slots:

  1. Open the inspector of the Loadout Manager component

  2. Set the Num Slots value to however many slots you want

  3. Uncheck the Slot Per Vehicle checkbox

To get rid of slots so that the player can only choose one loadout, simply check the Slot Per Vehicle checkbox.

Exclusive Vehicles

When you have multiple loadout slots, you may want the player to only be able to create one slot for each vehicle on the Loadout Items Vehicles list. To make this happen, simply check the Exclusive Vehicles checkbox in the inspector of the Loadout Manager component.

Exclusive Modules

You may want the player to only be able to add a module once for each module on the Loadout Items Vehicles list - that is, each module in the list can only appear on a single module mount. To make this happen, simply check the Exclusive Modules checkbox in the inspector of the Loadout Manager component.

Loadout Spawning

To spawn the loadout vehicle in the scene:

  1. Create a new gameobject and add a Loadout Vehicle Spawner component

  2. Add a Loadout Data Manager JSON component (or whatever data manager component you're using in the loadout menu) and drag it into the Loadout Data Manager field in the inspector of the Loadout Vehicle Spawner component

  3. Make sure the File Name in the inspector of the loadout data manager component matches the file name on the same component in the loadout menu

  4. Customize the rest of the settings in the inspector of the Loadout Vehicle Spawner component

Last updated