Search Unity

New to Custom Packages, couple of questions

Discussion in 'Package Manager' started by CrowbarSka, Apr 29, 2020.

  1. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Hello! I just started digging into the awesome world of Custom Packages. Love it so far, but I have some questions.
    1. I'm using packages stored locally on disk. Is it possible to prevent auto-updating and instead have an "Update" button like the official packages?

      i.e. some kind of simple versioning system, where a package is imported into a local project folder, thereby preventing it from automatically updating if the source package is changed, unless I explicitly tell it to

      I can foresee issues where I update a package for one project, but an older project uses an older version and is silently broken without me realising until I open it again. It would be nice if I could keep that older project using an older version of the package.

    2. What's the best way to handle abstract classes which rely on variable data that's unique to a project?

      For example, I have a class which handles opening web browser links to my websites. So the player can click a button in-game and be taken to a website. I can use the same variables names (e.g. "leaderboard", and "Steam page", but of course I want those URLs to be different for each game.

      What's the best way to do that? Maybe finding a reference to a scriptable object which holds the data?

    3. Can I create custom packages which have dependencies and references to Asset Store packages and their code?
    Thanks! :)
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    1. No locking feature for the local package, but you have two choices: set up a local registry (e.g. verdaccio), or set up a local git server. Both can handle version control.

    2. A few choices:
    • ask the consumer to create a configuration file on a convention path (JSON or scriptable object).
    • ask the consumer to create a runtime instance (game object) to hold the data.
    • ask the consumer to extend your class to implement a few data provider methods.

    3. Custom dependencies:
    • Official package dependencies? Yes, no problem.
    • Asset store dependencies? not supported yet.
    • Custom package dependencies on another registry (e.g. OpenUPM)? As long as your manifest.json can locate the dependent packages using scopedRegistry.
    • Custom Git dependencies? not supported yet, but seems in their backlog.
     
  3. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Thanks for the thorough reply!

    What does the "yet" mean there...? Is it planned?
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Sorry I don’t know. Could be a fuzzy memory, but I remember somewhere tells it will take a long time to convert existing store assets to UPM format.
     
    CrowbarSka likes this.