Search Unity

Will we be able to define our own Templates?

Discussion in 'Unity Hub' started by Schneider21, Jan 24, 2018.

  1. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,887
    It'd be great if we could set up our own templates, so that we can jump-start new projects to match our own workflows.

    For example, if I always use a certain set of assets, with a couple of prefabs for customized character controllers, quality settings, etc... I can start a new project with the Schneider's Startup template and have a few days work already done for me.

    This is the value I'd find in templates. Getting a basic 2D/3D setup I still have to do a lot of work for isn't all that exciting to me.
     
  2. massivebacon

    massivebacon

    Joined:
    Apr 24, 2014
    Posts:
    15
    Seconding this. I'm thinking especially for easily scaffolding projects, but also being able to more easily facilitate modding workflows that use the Unity editor for their main modding platform. Things like Sky Rogue, Cities Skylines, and others would be much benefited from being able to just provide a Unity template that people can use to easily get started modding without needing to import additional packages and configurations.
     
  3. Narv

    Narv

    Joined:
    Apr 4, 2013
    Posts:
    5
    Seems like the best way for this may just be to setup a project how you want the template to be. Then either from inside Unity or from the hub itself (having to save and close the project most likely) have a "Create Template" option that will create a custom template off the current Unity project.
     
    TaleOf4Gamers likes this.
  4. Shawn67

    Shawn67

    Joined:
    Jan 2, 2014
    Posts:
    2,196
    I already do this. The problem is the project may contain old versions of the assets whereas I see the template maybe installing the current version of the asset. I literally just found out about the hub beta, so I'm not sure if that is the case but that is how I hope/assume it works.

    I also would like to jump on the bandwagon with this request. It would be awesome if we could setup our own templates to use here.
     
  5. SpencerMowrey

    SpencerMowrey

    Joined:
    Nov 3, 2016
    Posts:
    4
    This has my vote!
     
  6. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    89
    By looking a bit around the Unity folders I found this folder inside latest beta version : Editor/Data/Resources/PackageManager/ProjectTemplates
    These are the templates used by Unity Hub. You can just duplicate one of the folders in there and update the package.json file to have the name and description you want. That will allow you to have a custom template.

    It's obvious that this is not the official way nor something that would survive an update but it's just to give you an idea of how it works at the moment.

    I'm just wondering if it will change because with this solution it means that templates are tied to Unity's version and that you would need to open Unity then the package manager to update them which is not great in my opinion. Maybe by having the package manager inside Unity Hub would help greatly ?
     
    Shawn67 likes this.
  7. the_natbird

    the_natbird

    Unity Technologies

    Joined:
    Jul 7, 2017
    Posts:
    2
    Yes! I think this will be important for streamlining and improving the Unity user experience! We have a bunch of plans for expanding the template system, including the ability to add and share custom user templates. Keep your eyes open for template updates in future Unity updates!
     
  8. StephenHodgson-Valorem

    StephenHodgson-Valorem

    Joined:
    Mar 8, 2017
    Posts:
    148
    Def a great idea. Any update on this?
     
  9. throzen

    throzen

    Joined:
    Jun 11, 2015
    Posts:
    4
    I hate to revive old threads, but this seems like the only one regarding this specific topic, so I'll post here and refrain from a new thread to keep things bundled.

    Has anyone found a way to add their project as a new template?

    Obviously dzamani's idea seem to be the right direction, and that is what I have been trying before finding this thread, but there seems to be an issue when doing that. At least I am having one:

    As soon as the "name" in your newly created template's manifest is set (or changed, if you have copied one of the other templates) an error occurs when choosing that template for a new Unity project:
    "Failed to resolve Project template: the folder or package [XYZ] could not be found"

    I tried naming things equivalent to how unity does, so folder and "name" in the manifest are the same, Folders that are copied to the template folder are the same... no difference as far as I can tell except for the manifest name. It really seems to be the name defined in the manifest that is the deciding factor. But it doesn't recognize the name of my template as an existing folder/template or whatever.

    Has anyone sucessfully done this and can tell me if I am missing something?
     
  10. Mickey_omar

    Mickey_omar

    Joined:
    Jan 7, 2017
    Posts:
    7
    Any news?
    I created a template and would like to understand more about the package.json file. What I want is to open a certain template directly in Android platform. I added this line "buildTarget":"Android" at the end of the json file and nothing happened. Any hints? or this is not even possible?

    Also, is there a way to include folders other than Assets, ProjectSettings and Packages? I would like to include the SteamVR 2.0 generated action json files rather than generating them every time I create a new project.

    Thanks a lot guys!

    EDIT:
    I tried adding the Library folder and it worked like a charm for the "Android part". Not sure what really solved it, the "buildTarget" or the "Library". Anyway, I did both in case someone wants to try.

    Have a nice day
     
    Last edited: Dec 4, 2018
  11. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    296
    Add me to those wanting to create our own project templates @the_natbird

    The first one I'd make is a cleaned out 3D project:
    • Without these packages: Advertisement, In App Purchasing, Analytics Library
      • These have to be removed one...by...one...ugh
    • With the following packages added
      • ProBuilder
      • Asset Bundle Browser
      • Post Processing
      • FBX Exporter
    • No Sample Scene
    • Player Settings
      • Rendering Color Space: Linear
      • API Compatibility: 4.x
      • Scripting Runtime: 4.x Equivelant
        • this always has to be changed and requires restart

    Then I'd make another one like the above that adds the following packages along with Vegetation Studio Pro:
    • Mathematics
    • Collections
    • Burst
    • Jobs
     
    JBAkka likes this.
  12. JBAkka

    JBAkka

    Joined:
    Dec 14, 2018
    Posts:
    1
    Thanks, MrG. Almost exactly what my team needs, too. So +1 on this.
     
  13. throzen

    throzen

    Joined:
    Jun 11, 2015
    Posts:
    4
    Hey guys.
    After I updated to Unity 2018.3.5 today (from 2018.2.16 previously) this seems to actually work if you are willing to go through the following steps (and not wait for unity to enable it though some simple interface of theirs):
    1. Go to your unity installation path and navigate to where the templates are saved. in my cast for example that is:
      C:\Unity\Unity2018.3.5\Editor\Data\Resources\PackageManager\ProjectTemplates

      From here we want to mimic the way the other tempates are defned. easiest way is to do the following
    2. Copy any of the other template folders and rename the end of it to whatever you want:
      E.g.: com.unity.template.mytemplate
    3. Inside that folder, you need to replace the Assets, Packages and Project Settings folders with the ones you want your template to have
      1. Go inside the ProjectSettings folder and delete the text files such as ProjectVersion.txt, so you only have all the .asset files left in it
    4. Go back to your com.unity.template.mytemplate folder and open the package.json file
      1. change the "name" attribute to match your template fodler name, i.e. com.unity.template.mytemplate
      2. change "displayName" to what you want it to say in the dropdown menu when choosing a template for a new project
      3. change the "defautScene" to the path of the scene you want to be opened by default when choosing your template. All relative to the newly added Assets folder, so for example "Assets/Scenes/MyStartingScene.scene"
      4. The rest is optional basically
    I tried that out yesterday and was able then to choose my template and it started everything as intended. No more error, like I described a while back in this thread, so they seem to have changed/fixed something with the Engine upgrade. No Idea in which version exactly this started to work, but with the currently newest Version (2018.3.5f1) I was able to do it.

    EDIT: it seems that your project version, as defined in the json file, needs to have 3 digits devided by a point, so 1.0.0 for example. That seems to be a convention for the templates, and the Unity launcher will not budge if you do not abide by that. I had 2 numbers at first and I would see my template in the launcher but get errors when trying to open a project using it

    cheers
     
    Last edited: Feb 26, 2019
  14. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    157
    instead of copying the assets from a template it would also be nice to provide a custom repository for packages, so i can simply provide a packages configuration for the templates
     
  15. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    12
    @the_natbird It's been over a year now, what's taking so long?
     
    KrzysztofX10 likes this.
  16. swanickj

    swanickj

    Joined:
    May 15, 2019
    Posts:
    20
    I hereby bump this. I'd be very happy for a custom template workflow.
     
    KrzysztofX10 likes this.
  17. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    268
    Just tried this based on @throzen's post above, but in Hub 2.1.1.
    Some things have changed, but baseline is: it is still possible to manually create your own templates.



    Unity has packed their templates into tgz files by now. 7zip can open and modify these. I found it easiest to just rename one of the default templates, open it in 7zip and copypaste my correct files in, but you can also just first create a tar archive, then gzip it, and rename the result from tar.gz to tgz.
    There's one thing you must do before copying one of your projects Assets/ProjectSettings/Packages folders in: delete the ProjectSettings.txt, otherwise there's gonna be an error.
     
    throzen likes this.
  18. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    673
    The problem is that we have to do it on each Unity Editor version... There should be some easier way to do this.
     
  19. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    268
    Definitely! Just wanted to update the information available with the current state.
     
    swanickj likes this.