Custom project template, Unity3D
Custom project template in Unity3D

Custom project template, Unity3D

This post contains affiliate links, which means I may receive a small commission, at no cost to you, if you make a purchase through a link.

Learn how to create a custom project template for Unity3D in Windows. You can do this for the Unity Hub or a single Unity installation, adjust the folders accordingly.

Open File Explorerer (Win+E) and locate the ProjectTemplates folder in either your Unity Hub installation or Unity Editor installation. Usually one of the following paths depending on your installation folder and version of Unity.

C:\Program Files\Unity\Hub\Editor\2018.3.11f1\Editor\Data\Resources\PackageManager\ProjectTemplates
C:\Program Files\Unity\Editor\Data\Resources\PackageManager\ProjectTemplates

Here you make a copy of one of the already existing project template folders, for example the com.unity.template.3d folder. You do this by holding down Ctrl then clicking and draging the folder or Ctrl+C then Ctrl+V.

Rename the last part of your new folder, make sure you keep the com.unity. part adding the name of your template in lower case letters.
For example: com.unity.template.cunstomtemplate

Run as administrator
Run as administrator

Step into the folder and open up package.json file in a text editor like Notepad or Notepad++. you need to run the text editor in Administrator mode which you can do by right clicking the icon and press Run as administrator.

Here you need to change some values of the different parameters. Begin with changing the value of the name attribute to be the same name as your folder (all in lower case letters).

The value of the displayName attribute is the name that will actually appear in the drop down box when you select a project template.

If you want to add a small one line description to appear bellow the dropdown once it is selected you can do so by editing the value of the description parameter.

If you have a default scene in your template add the path to it here, the path is relative to the project root. For example: “Assets/Scenes/SampleScene.unity”. You can leave this empty.

There are three different folders we might be interested to include in our template folder; Assets, Packages and ProjectSettings.

The Assets folder is where you can place any assets that you want to be included into your template, this could be any type of asset like scenes, script files, textures etc…

The Packages folder contains a single file named manifest.json, this file is for stating what extra packages to include when you create a project. This could be like ProBuilder and others. If you leave it empty like below you will still get some default packages like Unity Collaborate and more. To remove those please read further below.

{
	"dependencies": {
	}
}

It’s ok to leave it empty like above if you don’t want to include any extra packages, otherwise you add them like below, each package separeted by a comma.

{
	"dependencies": {
	"com.unity.textmeshpro": "1.3.0",
	"com.unity.probuilder": "4.0.4"
	}
}

The last folder is the ProjectSettings folder, here you can change the default project settings by editing them in a text editor. If you don’t include this folder Unity will generate the default project settings for you.

Please note that updating or installing a new version of Unity3D will possibly overwrite or remove your custom template so please keep a backup.

Changing default packages

Whenever you create a new project Unity will include som default packages into your project like Advertisement, In App Purchasing and more. Even if you remove these from the template packages they will still be included.

To change this you need to locate the manifest.json file for Unity Hub or a single Unity installation, typically found in one of the following folders.

C:\Program Files\Unity\Hub\Editor\2018.3.11f1\Editor\Data\Resources\PackageManager\Editor
C:\Program Files\Unity\Editor\2018.3.11f1\Editor\Data\Resources\PackageManager\Editor

Opening this file in administrator mode you need to locate the parameter defaultDependencies and from here find and remove the packages you don’t want to be included into the project. This willl of course effect all future projects you create and will also potentially be overwritten when updating or installing Unity.

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Top