• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

A20 - Consolidated Guide to Modding with Unity

A20 - Consolidated Guide to Modding 7D2D with Unity




First off, a disclaimer. I started modding and using Unity a few years ago when A16 was the current build, so I am not a Unity Pro. I have no formal training in using it, so the way I do things may well seem ugly to some folks more versed than I, but I can claim that the things I make in Unity work well. Hopefully after these tutorials yours will too, and eventually you can teach others a better way of doing things.

What you need to get started




1. Install the Version of Unity that matches the version of the game you want to mod. For A20, you need Unity 2020.3.xx or , for A19 you needed 2019.2.  How do you know which version to download? The game creates log files (Player.log and Output_Log that has a line near the top like this: Initialize engine version: 2019.1.0f2 (292b93d75a2c). That was A18.4, and you see it was built with Unity 2019.1   You can find all the versions of unity for the current and all previous alphas at https://unity3d.com/get-unity/download/archive 

2. Download the A20 Tutorial Unity project from my repo at https://drive.google.com/file/d/1DsFR0e1V-f0bNiZDAuVd0kb7_iYtyNqL/view?usp=sharing 

For A20 the current template is called: A20TutorialProject.zip

Terms of Use

 ​

  1. You are allowed to use the A20 Tutorial Project, including its custom Unity character Controller without any kind of direct modifications.  However, all modifications and/or use of A20 Unity character Controller contained in the A20 Tutorial Project and controller is restricted to private use only unless those modifications are done for use in other mods that have a dependency on the unaltered NPCCore mod (XNPCCore) being loaded with that other mod..  The controller contains purchased animations, so any derivative use of the models or controller is also contingent on purchasing those assets first.


Start up your copy of Unity 2020.3.x and load that tutorial project into it.  It is preconfigured for success, including the TagManager used by TFP, the MultiPlatformExport script, and templates for vehiles, characters, flags, guns and more.

Visual learner?   Watch some of these videos to help get you started.

https://www.youtube.com/channel/UCUAR3Bc_Z97lyT4zeI3-dcg/playlists



If you have questions, feel free to ask. We do expect that you watch all the relevant videos and understand the basics shown in them before asking questions. The best way to learn is to try to do it yourself first, then if your stuck we are here to help.

If anyone makes other Unity videos relevant to this game, please let me know so I can link it here.

Here are a few sample videos.  You can find more at the link above.






 
Last edited by a moderator:
I have attempted to add a sniper rifle to the game. The pink mesh was standing up on its nose, so I scaled and positioned accordingly. I exported the .unity3d file.

The path is Mods>My Rifle Attempt>resources>the unity file

What is happening is I'm getting the object not set to reference of an object error. I am also getting the error that says there is no transform called "Attachments".

I did create an empty object for the prefab. I went back after the first round of errors and created another empty object called "Attachments" and added that to the prefab to store the scope. The scope is the only attachment. I am just trying to get the gun in the game and rotated properly. I was going to start with that and then add attachments and whatnot.

I'm not sure what I've done wrong at this point.

It does show up in the game. I just used a tinted icon from the regular sniper rifle in the game. When I try to pull it out, I get the error. The player is holding an invisible gun that does nothing.

<item name="SniperRifle_SS">
<property name="CustomIcon" value="gunRifleT3SniperRifle"/>
<property name="CustomIconTint" value="#50C878"/>
<property name="Tags" value="weapon,ranged,holdBreathAiming,reloadPenalty,gun,barrelAttachments,sideAttachments,smallTopAttachments,mediumTopAttachments,largeTopAttachments,stock,magazine,firingMode,bottomAttachments,attPerception,perkDeadEye,attachmentsIncluded,canHaveCosmetic,rifleSkill"/>
<property name="DisplayType" value="rangedGun"/>
<property name="HoldType" value="77"/>
<property name="Meshfile" value="#@modfolder:Resources/SniperRifle_SS.unity3d?SniperRifle_SS"/>




Maybe the path for my Mesh file is incorrect? I got this from another mod that added an axe to the game and just tried the path, so it is likely my own fault, but I'm not sure how to do this at all.

Edit:

I also tried this:

Code:
<property name="Meshfile" value="#@/Mods/My Rifle Attempt/resources/SniperRifle_SS.unity3d"/>
 
Last edited by a moderator:
I have attempted to add a sniper rifle to the game. The pink mesh was standing up on its nose, so I scaled and positioned accordingly. I exported the .unity3d file.

The path is Mods>My Rifle Attempt>resources>the unity file

What is happening is I'm getting the object not set to reference of an object error. I am also getting the error that says there is no transform called "Attachments".

I did create an empty object for the prefab. I went back after the first round of errors and created another empty object called "Attachments" and added that to the prefab to store the scope. The scope is the only attachment. I am just trying to get the gun in the game and rotated properly. I was going to start with that and then add attachments and whatnot.

I'm not sure what I've done wrong at this point.

It does show up in the game. I just used a tinted icon from the regular sniper rifle in the game. When I try to pull it out, I get the error. The player is holding an invisible gun that does nothing.

<item name="SniperRifle_SS">
<property name="CustomIcon" value="gunRifleT3SniperRifle"/>
<property name="CustomIconTint" value="#50C878"/>
<property name="Tags" value="weapon,ranged,holdBreathAiming,reloadPenalty,gun,barrelAttachments,sideAttachments,smallTopAttachments,mediumTopAttachments,largeTopAttachments,stock,magazine,firingMode,bottomAttachments,attPerception,perkDeadEye,attachmentsIncluded,canHaveCosmetic,rifleSkill"/>
<property name="DisplayType" value="rangedGun"/>
<property name="HoldType" value="77"/>
<property name="Meshfile" value="#@modfolder:Resources/SniperRifle_SS.unity3d?SniperRifle_SS"/>




Maybe the path for my Mesh file is incorrect? I got this from another mod that added an axe to the game and just tried the path, so it is likely my own fault, but I'm not sure how to do this at all.

Edit:

I also tried this:

<property name="Meshfile" value="#@/Mods/My Rifle Attempt/resources/SniperRifle_SS.unity3d"/>



Another Edit (I guess you can only do one):

I switched to a pistol and got it to work. The code is all fine. The problem now is there is no texture. Just a white gun. I'm not sure what to do about that as all tutorials just say to export the prefab.

 
Is it a bad idea to try to follow this guide for staring to mod version 1.0 and then just troubleshoot when issues / discrepancies arise?

 
Is it a bad idea to try to follow this guide for staring to mod version 1.0 and then just troubleshoot when issues / discrepancies arise?
No, almost all of it is valid still.  The Unity version to use changes every alpha, but the last version for A21 still works well, as does that tutorial project

 
Is this sticky still up to date?

Because the Tutorial Project can no longer be found on Google Drive.

Opera-Momentaufnahme-2024-09-18-084844-drive-google-com.png


(Image from 18.09.2024)

And i see in your Videos that your Unity named in the Titlebar "Web Player <DX11>". I downloaded various Unity Editors but my says in the Title bar "PC, Mac & Linux Standalone <DX11>"

greetings

 
Last edited by a moderator:
Is there an updated link or somewhere else to download 'A20TutorialProject.zip' from?  Looks like the Google Drive link doesn't work anymore.

 
Back
Top