Unturned

Unturned

69 ratings
Unturned Gun Modding Tutorial
By Zykrah and 1 collaborators
This is a simplified guide on basic unturned modding (Guns)
   
Award
Favorite
Favorited
Unfavorite
Introduction
As of 2020, a lot of this tutorial is outdated. Won't be updating. Sorry.

==================================================

Modding is not easy, it is a very amazing aspect of Unturned though. Be noted that you need to be patient when learning to mod, very patient. Read every single word carefully and do not skip anything.

If this guide helped you in any way, i would deeply appreciate it if you rated and shared this guide.
Thank you and the best of luck on your modding journeys! :D
Getting models ready and exporting into fbx files
1. Get your model ready in blender. This tutorial does not include creating models, since there is no real exact tutorial for creating models.

We will be using the 3Dmodel editor, Blender since it is free and easy to learn.

---------------------------------
A few important things to note

-In blender, select any models you have and press Ctrl + A and select Rotation & Scale. This will prevent any scaling or rotation problems in Unity. Note: Do not press Location.

-The origin of the gun should be somewhat infront or where the trigger is, if you are using nelson's provided animations

-Make sure your model is facing to your right in the 'Numpad 3' (Right Ortho) view. If your model is not then go into either 'Numpad 7' or 'Numpad 1' and roatate it by pressing 'R' and typing in the degree of rotation. Eg: 'R + 360' will roate your model a whole 360 degrees.

Your model should be along the lines on this screenshot

---------------------------------

2. Export your model by selecting the objects you DO NOT want to export first and delete them by pressing 'X'. Make sure you save before doing this incase of any lost models. Then in the top menu click 'File > Export > Fbx' and save it on your desktop or in a folder where you can find it later.


3. Export any extra models you have by pressing 'Ctrl + V' one or two times until your models come back. The repeat step 2, on towards undoing your deletes once more. Or just close the window if you have already saved your model before deleting anything.

4. Make sure you have Unity 5.5+ and the latest version of the Asset Bundler for unity.

Unturned Is currently using version 5.5.1, so 5.5.1f is reccomended.

------------------------------------------------------------
Unity 5.5 and Asset bundler [5.5 is needed]

Unity downloads:
https://unity3d.com/get-unity/download/archive
Download the Unity 5.5.0 or later. 5.5.1f is reccommended

Asset Bundler Tuorial:

-Installing and Set-Up:
So, for starters, I suggest that you uninstall Unity (Don't worry, if you dont know how to do that, the installer will do it for you, it will just take longer). Then, all you do is go to the Archive page [unity3d.com] of Unity and download Unity 5.5.0 or later 5.5.1f is recommended

Now, start-up Unity and create a new project. Once that's done, in the Assets folder create a folder named Editor, in it, create a folder named Tools.

Now, you need to go to your Unturned game files located in:
[Your Hard Drive]:\Program Files (x86)\Steam\steamapps\common\Unturned\
OR
[Your Hard Drive]:\Program Files\Steam\steamapps\common\Unturned\

Now go in Bundles\Sources\Tools\Bundle Tool\ There will be a file named BundleTool.cs, copy that file and put it in the Tools folder created earlier. Now go on the top-left corner of the screen in Unity and find the tab named Window, click on it and then click on the drop-down option named Bundle Tool, it will open the Bundle Tool and put it wherever you see fit.

Now I suggest that you set back the Layers and Tags. You can also bring the example files provided by Nelson. I also strongly suggest that you salvage what's left of your old project like the models and assets. If you bring only the assets but not the models, you wont see the model in Unity or in-game.

Tags:


Layers:


-Bundle Items:
Now to bundle your item it's pretty easy, create an Asset Bundle folder in Assets, there you can import all of your previous work or your new work in separated folders. Remember, each of your items must have their own folders. To bundle them just select the folder containing your assets, go in the Bundle Tool, press Grab, and press Bundle Item, it will open a directory to where you want to save your unity3d file, I suggest that you save it in a different folder than where you put your assets to bundle for example "Bundled Assets" Give it a name and now the process is the same as before, put that unity3d file wherever it should go, like before.


Credit to "Mordecai Sanders" for the original Asset Bundler tutorial that can be found inside of his group. I do not take any right for the Asset Bundler tutorial.
-------------------------------------------------------------
Creating the gun files inside Unity
5. After setting unity up, drag your fbx files into unity. [Bottom Section] 'Model' Folders are recommended for easy access to all your models.

6. Go to where your gun's Fbx file is located and click on it once. On the right of unity, click the 'Animations' Tab and unselect Import Animations. Then click Apply.

7. On the left side of Unity, right click and press 'Create Empty'

8. Right click on it and rename it 'Item'

9. Make another but this time, drag it into 'Item' and duplicate it (Ctrl + D) 6 times

10. In this specific order, rename them to 'Icon, Grip, Barrel, Sight, Tactical, Eject and Magazine'

11. Drag your gun's fbx file and drag it into 'Item'

12. Rename it to 'Model_0'

13. Now make sure everything is Tagged and Layered to Item [On the right of Unity]
-Tags: http://images.akamai.steamusercontent.com/ugc/693902202124334282/13EDB1AB731662895A610BCFD8A7F2A5A63D3AC9/
-Layers: http://images.akamai.steamusercontent.com/ugc/693902202124334545/FB5BF0083F40A7E286055FB8938E792189303882/

14. Make sure everything's scale is set to 1 apart from Model_0 which you might tweak later on

15. Make sure everything's rotation is set to 0 apart from Icon which you will might tweak later on

16. Make sure everything's location is set to 0 but keep in mind you are going to be moving most around

17. Move 'Grip, Barrel, Sight, Tactical, Eject and Magazine' to their designated spot on your model.

------------------------
Note:

-If a Tactical is placed on the left of a gun, set its roation to: X=0 Y=-90 Z=0

-'Eject' is where the bullet shells come out from. Its rotation should be: X=0 Y=90 Z=0 [My Opinion. Edit to whatever you want]

-'Sight' is where you aim without a sight. It is also where the origin [Blender Origin] of sights will be placed.
------------------------


18. For 'Icon', Add the camera component and set 'Projection' to Orthographic. Then set the size to 0.4

19. Rotate 'Icon' to your preffered rotation and adjust it to fit the whole gun in the camera preview. Do not change the size, only move 'Icon' around.

20. Now remove the Camera component by right clicking on it and pressing 'Delete Component'. If you do not, Your game will glitch out.

21. In your Asset Bundle folder, create another folder by right clicking and pressing 'Create > Folder'

22. Name this folder to what you want your unity3d file to be named.

23. We will use this folder later so just keep it there until a few steps after.

24. Click on 'Item' and on your right, add two components; 'LOD Group' and 'Box Collider'
25. In 'LOD Group', right click and press delete. Do this twice until you only have 'LOD 0' and 'Culled'

26. Drag 'Culled' to about 3% or 4%

27. Click on 'LOD 0' and press the big 'Add' Button. Select 'Model_0' and press Enter

28. Press the two buttons that say 'Bounds' and 'Lightmap Scale'

29. For the box collider, simply press the button next to the words 'Edit Collider' and drag the green dots to the edges or your model. Don't forget to size in all axis'

30. Re-check that you havent missed any steps in this tutorial.

31. Drag 'Item' into the folder created earlier
Animations and sounds
32. Create a new gameobject in the left section of unity and rename is Animations. (Make sure it's it own game object and isn't in the 'Item' gameobject)

33. Click on your 'Animations' gameobject and on the right section of unity, add the animation component. Also, Set the Tag and Layer to Logic

34. For the animation component, set the size to 10 and leave everything else.

35. Make sure you have the Animations.fbx file in unity otherwise you will not be able to finish your mod.

(To get the updated animations, go to whichever Program Files folder you use, 'Steam/steamapps/common/Unturned/Bundles/Sources/Examples' and take the Gun.unitypackage file and double click it. Then accept the Importing and find the Game file which should be at the bottom left side of Unity and keep on clicking each file until you find the animation file. Take this file and put it in a folder where you can go back and use it. A Models Folder would be useful for this)
-----------------------------------------------------
Folder Example:
C:\Program Files (x86)\Steam\steamapps\common\Unturned\Bundles\Sources\Examples
OR
C:\Program Files\Steam\steamapps\common\Unturned\Bundles\Sources\Examples
------------------------------------------------------
----------------------------------------------------
MAKE SURE YOU DO THIS
1. Right click on the folder where you put your Animations.fbx file and click 'Show in explorer'

2. Find the Animations.fbx.meta [MAKE SURE IT IS THE .FBX.META FILE AND NOT THE ORIGINAL .FBX] file and right click it. Click on edit with notepad++. (If you dont have notepad++ yet then google it and download it)

3. Scroll down all the way until you find useFileScale. (You can press Ctrl + F to find) Then set 1 to 0.
(If you don't do this your animations will literally break)

Few more things:
1. Make sure your animation fbx file is set to 'Legacy' and 'Store in Root (New)' in the 'Rig' tab.
-To do this, click on the fbx and in the inspector tab on the right, you should see 3 tabs. Click on Rig and for 'Animation Type', make it 'Legacy. Then make sure the 'Generation' is set to Store in Root (New)

2. Make sure all your animations are set to 'Clamp forever'.
-To do this, open your animation.fbx's inspector tab (right of unity after you click on it) and click on each animation. Make sure each one has 'Clamp Forever' instead of 'Default' on the Inspector tab on the right of unity. The setting should be at the bottom of the component, not the top one.

For the second last one, nelson should have already done those steps (No Guarantee so i still recommend checking), but if you are using custom animations, make sure it is set properly.
----------------------------------------------------

36. Now drag and drop the animations (from the Animations.fbx to the animation component of the object you just made) in the exact same order: Equip, Aim_Start, Aim_Stop, Attach_Start, Attach_Stop, Sprint_Start, Sprint_Stop, Reload, Hammer and Inspect.

37. Now drag your animation gameobject (Left of unity) to your folder in the asset bundle folder. (Assets > Data > Asset Bundles > [Your folder])
If you have any sound files, (MP3 or WAV files) place them in your folder each named either 'Shoot, Hammer, Reload or Aim'
Asset bundling and configuring .dat files
38. To Asset bundle, go to your Asset Bundle Folder and select the folder you just put everything in.

39. Then, on top of Unity, there should be a tab called Window, click on it and then, on the pop down bar, there should be a option called 'Asset Bundle'

40. Click on this and a small window should pop up.

41. Make sure you have your folder selected and press grab in the asset bundle window.

42. Another Window should pop up asking you where you want your 'Unity3d' file to be, i would recommend leaving it on your desktop or in a deticated folder on your desktop

43. Go to your Unturned folder - Bundles - Items - Guns and copy one of the guns folder that is most similar to yours. Rename it the exact same name as your bundled 'unity3d' file. Then move the copid file to any workshop mod folder. (make sure to delete the folder or move it afterwards when finished with the mod)

44. Inside the folder change the [name].dat to [your_bundle_name_here].dat. Inside the .dat file change its ID to some high value and configure your gun's properties. Nelson's guide may help you with configuring these

45. Drag and drop your bundled gun file inside the folder and open up the English.dat to set up gun's in-game name and description

46. Launch up Unturned and go into singleplayer. Spawn in your gun and see if there are any problems. If there are please tell down below in the comments!
If you do not know how to configure the files then please take some time to have a look at all the sections in the .dat folder.
FAQ and Q&A
This is just a small section of this tutorial where i want everyone to discuss their issues and problems.

The main thing to do if you have any problems is to re-read the whole tutorial to make sure you didnt miss anything. Make sure to follow all steps unless told not to in certain cases. The "Make sure you do this (etc)" sections are very important and must be read to solve many problems, which goes along with what i just said; read carefully.

If you have any issues either solved or unsolved please put them in the comments so i can add them here for others to read.

FAQ/Q&A:

Q: My gun wont spawn in!
A: There are actually multiple causes for this. Your biggest bet here is to re-read the guide. Other reasons include the following:
-The names of everything arent spelt correctly in Unity. (They are case sensitive)
-ID is conflicted
-Names of files inside your finished mod arent the same

Q: My character wont equip the gun!/ My Character's hands has the gun stuck in it!
A: Again, there is more than one reason, here following are the main reasons:
-You didnt set Clamp Forever to your animations
-Files arent set out or made properly
-ID is conflicted
-Layers and Tags arent set properly
-You arent playing singleplayer
-You didnt add the files to a workshop mod folder

Q: Hands arent lined up with the gun!
A: Move the origin in Blender or move the model inside 'Item' in Unity

Q: The gun is rotated and is too big!
A: Just scale down and rotate the gun to the right size/rotation in Unity. Although, Make sure to edit Model_0, And NOT Item

Q: I cant see it in First-Person!
A: This can be caused by false tagging and layering or LODs, re-read the guide

Q: I cant see my gun in Thirdperson!
A: Similar to the reason just above this one, tagging or LODs

(There are many more reasons but these are the main, if you have any more please comment them below!)

This FAQ/Q&A is still in progress, more will be added
Magazines! (Finally)
Note that this tutorial is just a simple one, no step by step, just wording. I will be improving this later on though...

Also sorry for the late tutorial... xD
--------------------------------------------------------------------------

Magazines are probably the easiest part of modding guns, so this will be pretty simple. Making magazines is as simple as dragging two of your magazine models onto the left section of Unity. Name one of them "Item" and the other "Magazine".

For "Item", just add a "Icon" the same way you would to the gun. And for "Magazine", just leave it the way it is. You do not need to place another model inside any of the folders since the folders themselves are already models.

Now, all you need to do is set up the tags, layers, LODs, and box colliders the same way you would for the Guns. [If you don't know, read the tutorial on basic gun making above]
--------------------------------------------------------
Again, sorry for the late tutorial.
Final Notes
------------------------------
ONE LAST THING
If you have any problems please ask me
------------------------------

I will be updating this tutorial soon. (How to make custom magazines)

If i have missed anything please tell me! Otherwise everyone would get problems!
289 Comments
Yon POP Glanetashull Apr 6, 2021 @ 3:41am 
i cant spawn them by id and i did everything u specifyed in the faq
Zykrah  [author] Jan 16, 2021 @ 10:20am 
Hey, this tutorial is a little outdated (very) and I haven't kept up with modding so this tutorial may not fully work. But as of what I remember, step 17 is just about moving the objects to where each respective object will be positioned. ie barrel goes on the very end of the gun barrel and the mag goes roughly where the mag should be. The point you put it at is where the origin of that attachment will be in game. Hope this helps.
Luxe Jan 10, 2021 @ 11:52am 
Is anybody able to help me with #17?
Zykrah  [author] Aug 10, 2020 @ 2:07am 
@pokeportalreal i havent made guns or mods in unity for a long time... If anyone wants to update the tutorial for me i wouldnt mind, however, i do not see myself updating this tutorial in the forseeable future.
Kuyosa Jul 10, 2020 @ 8:36pm 
As of when I'm writing this, unturned Devs have moved all files together, also when that happened the animations were turned into a different type of file, mainly .logs. Unity has changed a lot since this, including the fact that the "asset bundles" just slaps a note pad next to it in the files.

Long story short, the game and the software used to mod it have both changed quite a bit, and this tutorial could use an update
ABCD Feb 8, 2019 @ 12:59am 
Help i not have button Bundle tool, I import bundel tools and content tools my project unity
JokingCookie Nov 17, 2018 @ 6:21am 
It still does not work...

I'm trying to make a weapon. I have tried every possible location for the folder.
To be sure, my own gun isn't the reason, i take a other workshop gun which dont work too.

What elese can I try? Pls help

Sorry my English is not so good.

-------------------------------------------

Deutsche Erklärung:

Egal, wohin ich den Ordner, von meiner Waffe hin verschiebe, es funktioniert nicht. Um sicher zu sein, dass ich beim Erstellen der Waffe keinen Fehler gemacht habe, habe ich es auch mit einer Beispielwaffe von Nelson probiert, bzw eine Waffe aus einem Workshop Waffenpack, die normalerweise funktioniert. Alles funktioniert nicht.
Hat jemand eine Idee, wo mein Fehler sein könnte?
ZoliWorks  [author] Nov 17, 2018 @ 5:16am 
<Drive>:\SteamLibrary\steamapps\workshop\content\304930\<already existing random numbered folder>

But i prefer putting them into <Drive>:\SteamLibrary\steamapps\common\Unturned\Bundles\<select category>
JokingCookie Nov 17, 2018 @ 2:45am 
"43. Go to your Unturned folder - Bundles - Items - Guns and copy one of the guns folder that is most similar to yours. Rename it the exact same name as your bundled 'unity3d' file. Then move the copid file to any workshop mod folder. (make sure to delete the folder or move it afterwards when finished with the mod)"

In which workshop folder, what is the path?

I tried everything, but it does not work.

please help! :csgo_despair:
Zykrah  [author] Sep 25, 2018 @ 11:43pm 
yep no worries, gl