Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

how to setup unity so it automatically imports my most used/favourite packages.

Discussion in 'General Discussion' started by NerdGamer99, Aug 1, 2023.

  1. NerdGamer99

    NerdGamer99

    Joined:
    Dec 8, 2019
    Posts:
    3
    literally the title.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,860
    Ryiah and angrypenguin like this.
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,321
    You can also use version control and start every project of the same base repo.
     
    Ryiah, CodeSmile and angrypenguin like this.
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,013
    Just wondering, do both of these solutions have the issue that you will always install whatever versions of the package were up to date at the time the project template was created?

    This would mean that you‘d still have to go to Package Manager and update all the packages that have updates available. Or worse, it may try to install deprecated packages or packages that just won‘t work in older Unity versions.

    I think one way to achieve a similar effect would be to record all the desired entries from manifest.json and pasting those into the manifest.json of a new project but leaving the version field empty. I‘m not sure though whether that will default to downloading the latest version of the package for the given Unity version. I never tried that but something tells me that‘s what ought to happen if you leave the version field empty.
     
    Antypodish likes this.
  5. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Creating a project and using that as the base for new projects does at least have "that issue", but one could argue if that's actually an issue. I don't update stuff unless I need to. So if my version of Unity works and the versions of whatever packages I'm using works, then it would be counter-productive for me if the packages automatically updated to new untested versions whenever I started a new project based on my "base project". I would only want them to update if I encountered an issue and needed to update. Then I could manually review the changes in the new version of the package, and I could at the same time evaluate if I should update my base project at or if just this particular project needs this version for example.

    I was thinking about the exact same thing as OP a while back and the two solution I found were the same two solution proposed here.

    I looked into project templates, but I felt they were too cumbersome to setup and also to maintain, and the only benefit I could see from using them is that you can select them in the hub when creating a new project. I ended up going with the solution neginfinity suggests here. I created a project exactly how I would normally. Configured all project settings, input settings, external packages, local packages, project folder structure, as well as IDE project settings and whatever else, and ensured everything was tracked in git. Tracking it in git (or any version control) isn't actually required for any of this, it's just nice.

    To create a new project I just duplicate the base project folder, which is what you could say is the disadvantage with this method, ie. not being able to create the project through the hub, but having immediate and easy access to the base project and it's version history for when you need to update the base project or are wondering why something is setup the way it is, is a clear win with this method imo. And duplicating the folder is quicker than creating a new project through the hub anyway :p I just have the base project in a folder in my Dropbox, where I actually have all Unity projects, but you could of course have it hosted on Github or whatnot as well, and regardless if you are using git then you could just clone the repo to create a new project if you wanted to instead, which I'm sure would be even faster than duplicating the folder, but I'm not a "terminal wiz" :p And I'm sure that works similar with other types of version control, but I have no experience.

    I think this works more than fine, and haven't really looked for a better solution after going with this.
     
    CodeSmile likes this.
  6. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    Its odd, i know they have made making templates more complex than it was a few years ago, but i tried the intructions on this page. I took a nice empty project i had with packages I wanted in - nothing in the assets folder, and did as they said, copied the tgz of a working template, deleted the 3 folders, copied my 3 folders, removed the version file.. zipped it backup and.. well that was it, couldnt make new project now, as it would just hang on loading templates.. so clearly something was not quite right. I shall probably try again later, but why cant it just be a simple process?? <sigh>
     
    vertexx likes this.
  7. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,013
    Well, it's quite simply a matter of usefulness. How many Unity users create a new project - one with dozens of dependent packages specifically - on a frequent enough basis that it warrants starting new projects with a custom setup easier?

    On average I start a new project every week, most of them just for testing. Still I need to import packages here and there. It's still not too time consuming that I'd spend a couple hours setting up a template.

    In my case specifically, actually I often DO want to start from scratch. It would be downright self-defying if I started even test projects with all the custom packages already in it - slowing down both creation of the project (initial Library creation) and the editor (domain reload and all that) plus risking that whatever I test is affected by the packages and settings I have in the project, rather than testing with a clean slate.
     
  8. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    Not every one wants visual scripting or unitys version control, in every project.

    It also always puzzled me why a new blank project without asking it always selects
    upload_2023-8-2_9-57-54.png
    from
    upload_2023-8-2_9-58-57.png

    Like you I make a bunch of new projects and probably delete them a few times a week, because im testing or trying something. The whole point of a template is if you want to have a barebones, or a prelaiden setup.. you can, but they have gone from it being easier to harder.. just like they took away the install packages v x, you can now only have latest. So maybe you dont want the broken probuilder 5.1.0 you want the 5.0.7 that was stable..
     
    Last edited: Aug 2, 2023
  9. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,744
    Every new project I create includes several specific packages and assets. Every time, for every client.
     
    bugfinders likes this.
  10. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,013
    Yeah, I get the "remove unnecessary packages" ... I do that often, just because I don't like Visual Studio Editor package being there, totally unused. :D

    However ... I've done some project stripping and removing like a dozen excess packages did practically nothing to build size (WebGL, release build). It wasn't until I went into "Built-In" category and disabled unused modules (Cloth, Vehicles, Wind, etc.) that the build size decreased by a megabyte or so. If you go for minimal build size, removing unneeded Built-In modules seems to be far more effective than disabling packages, especially if they are editor-only (or: editor-mostly).
     
    bugfinders likes this.
  11. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    but for example Id rather start with empty and add what i need than try and ditch a load of stuff i know i never wanted.