Unturned

Unturned

34 ratings
(WIP) How to set up custom vehicle for Unturned Workshop
By Maikee Maous
*Please note this guide is still a work in progress*

This guide will go through on how to set up custom vehicles for Unturned exported from Unity. By the way this guide will not cover on how to use 3D modelling programs and how to export models from there. As of now the guide will be for wheeled vehicles.
   
Award
Favorite
Favorited
Unfavorite
0.1) Setting up Unity
This first part is for those who has not set up their computer yet for making mods or that you might have not set up Unity correctly.

Remember to take note of the Unity version that it should be 5.4.x

(Please note the first video is outdated, I will eventually replace it with a newer video)



Stuff that you will need to create workshop mods:
1.1) Importing Unturned examples into Unity
The unityPackage examples are a great sample reference for any particular workshop content that you are working on.



The default directory for the examples folder are as follows:
Windows
C:\Program Files (x86)\Steam\steamapps\common\Unturned\Bundles\Sources\Examples
Mac
~/Library/Application Support/Steam/SteamApps/common/Unturned/Bundles/Sources/Examples

How to import the unityPackage into the Unity project:

1) First open Unity and select the project that you have set up for creating the assetBundles. If you have not set up Unity yet, check out Part 1 of the tutorial video above in this guide


2) After the project window opens, either right click in the Assets tab directory to open up the Import Package window or drag-drop the unityPackage directly into the window
3) Make sure all the objects are selected/ticked before pressing the Import button

The example from this unityPackage that will be taken reference from will be this Yellow Hatchback. Either drag the Vehicle prefab into the Hierarchy window or the Scene window.
1.2) Importing custom models into Unity
The recommended model file format for Unity is the fbx format. For better organization, I created a Models folder in the Assets directory for a place to store the models.

To import the fbx file, either right click the window space in the Projects tab to Import New Asset or drag drop into the directory directly

One thing worth checking on the imported fbx is the Scale Factor. You can either change the size of the model from the Scale value in Transform attribute or changing the multiplier in the Scale Factor. If changed in the Import Settings, remember to press Apply at the bottom of the Inspector.
2.1) Getting started on creating a vehicle
Create a new folder in and name the folder based on what vehicle you are creating, here are some examples of my folder names:


For this tutorial I am working on a 6x6 offroader, and the following image shows the contents in the folder and what are each of its purpose:
(don't worry if you haven't got these stuff done yet I am just trying to explain the contents first)

Name
File Type
Purpose
Clip
prefab
The object that server-side takes reference from in the game
Engine
audio file (eg. mp3, wav, ogg)
The engine audio file that the game will loop
Horn
audio file
The horn audio when the player presses the horn in-game, optional if there is no horn for the vehicle
Ignition
audio file
The ignition audio when the player hops on the driver seat in-game
Vehicle
prefab
The main component of the whole assetBundle, contains gameObjects such as the models, light sources, seats positions and the fire particle effects

My personal favourite approach to making Unturned assets is modifying existing prefabs instead of creating them from scratch and adding the components. Either approach is fine when it comes to creating them.
2.2) Applying/Updating the prefab
For this tutorial I will be making use of the Vehicle prefab that has been dragged into the scene to modify it to the vehicle that I am working on.

To apply a prefab, simply drag the Vehicle gameObject into their corresponding folder. It will apply any changes you made.

To update the prefab, delete the older version of the prefab from the Project folder while there is still a copy in the Hierachy and drag in the new one to overwrite. The name of the gameObject in the Hierarchy will turn from blue to red upon deleting as it breaks the link from the old version and it will turn back to blue after applying the prefab again.

3.0) GameObjects and their components
Name
Tag
Layer
Components
(The name of the gameObject, changeable from the Hierarchy or Inspector)
(Make sure the names are correct and the sequence of the Tags are in the right order)
(Also make sure the names are correct and the sequence of the User Layers are in the right order)
(All gameObjects at least have the Transform component, so I won't add that as part of the required components)
The sequence of the gameObjects in the prefab does not matter as long as it is parented correctly, but the following will be the sequence that this guide will be going through. The details for each of the gameObjects will have a table for what they contain and what to take note of when editing the gameObjects.

3.1) Vehicle (ROOT)
Name
Tag
Layer
Components
Vehicle
Vehicle
Vehicle
LOD Group, Rigidbody, Audio Source, Box Colliders

Vehicle is the main part of the prefab.

Rigidbody

Audio Source

Box Colliders

LOD Group
(Refer to 3.15 LOD Group)
3.2) Model_0/ Model_1
Name
Tag
Layer
Components
Model_0
Model_1
Vehicle
Vehicle
Mesh Filter, Mesh Renderer
3.3) Bumper
Name
Tag
Layer
Components
Bumper
Trap
Trap
Box Collider
3.4) Nav
Name
Tag
Layer
Components
Nav
Navmesh
Navmesh
Box Collider, Rigidbody (?)
3.5) Seats
Name
Tag
Layer
Components
Seats
Vehicle
Vehicle
Nil
3.6) Tires
Name
Tag
Layer
Components
Tires
Vehicle
Vehicle
Nil
3.7) Smoke_1/ Smoke_0/ Fire
Name
Tag
Layer
Components
Smoke_1
Smoke_0
Fire
Debris
Debris
Particle System
3.8) Wheels
Name
Tag
Layer
Components
Wheels
Vehicle
Vehicle
Nil
3.9) Objects
Name
Tag
Layer
Components
Objects
Vehicle
Vehicle
Nil
3.10) Sound
Name
Tag
Layer
Components
Sound
Player
Player
Audio Source
3.11) Headlights/Taillights
Name
Tag
Layer
Components
Headlights
Taillights
Vehicle
Vehicle
Nil
3.12) Sirens
Name
Tag
Layer
Components
Sirens
Vehicle
Vehicle
Audio Source (?)
4.1) Clip (Prefab)
4.2) Audio Files
5.1) LOD Group (Component)
5.0) Components in GameObjects
Components give GameObjects functionality. For this section we will go through what components are involved and how do we apply them to which gameObjects

http://docs.unity3d.com/Manual/UsingComponents.html
28 Comments
piiko 29 Jun, 2020 @ 4:00pm 
It's kinda sad that I can't find any good guide on how to make a vehicle model
plus I doubt that the forum and reddit is helpful, neither is YT :L
Anti 7 Feb, 2020 @ 2:08pm 
@Mastardy Same error
Cold Mastardy 13 Mar, 2019 @ 6:27am 
"Failed to analyze TestCar.dat: Missing 'Vehicle' GameObject" pls help xD
Maikee Maous  [author] 25 Jul, 2018 @ 7:47pm 
Make sure Spatial Blend is set to 3D / 1

You can read up more on the Audio Source component below:
https://docs.unity3d.com/Manual/class-AudioSource.html
Garrett 25 Jul, 2018 @ 12:12pm 
Do you know how to make the siren not be so loud! People in olimpia can hear my car while I’m in Kent raceway!
Garrett 25 Jul, 2018 @ 7:48am 
Oh wow, thanks.
Maikee Maous  [author] 25 Jul, 2018 @ 1:31am 
For the Audio Source component in Sirens, make sure Loop is checked
Garrett 23 Jul, 2018 @ 2:04pm 
How do I make the audio of the siren loop. It starts then stops
Maikee Maous  [author] 10 Aug, 2017 @ 6:39am 
The default example did not set the Import Settings correctly. Using .wav instead of .mp3 will give less issues
Rico 10 Aug, 2017 @ 5:05am 
No, you understood me. I mean, how do I put sound on my vehicle / gun? Because in the standard example Nelson - There is simply no sound