Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Working with local packages, while publishing URL-linked projects

Discussion in 'Package Manager' started by eelstork, Oct 20, 2019.

  1. eelstork


    Jun 15, 2014
    File under "ugly workarounds".

    • Have package under dev
    • Have project using said package
    • Using Git
    • Want to iterate quickly so would prefer a local dependency. But also need to keep both project and package in git, and remotes up to date.
    Unstable because we want a local dep, and a URL dep at the same time. So this is how I do it, for now.

    STEP 1 - Setup URL dep for remote:
    1. Edit Packages/manifest.json to add the URL dependency. This is for the remote and won't exist locally.
    2. Commit right away (don't switch back to Unity at this point)
    3. Now switch back to Unity (this is only to verify the URL/JSON are correct)
    4. Reset/discard the additional metadata that was just added at the bottom of manifest.json (do this if you do not want the remote to freeze the dependency to current commit.
    5. Push.
    STEP 2 - Setup for working locally
    1. Delete the URL dep from manifest.json
    2. Add a local (file dependency) dependency instead; can do this via the package manager GUI ('add from disk')
    3. Run this:
      git update-index --assume-unchanged Packages/manifest.json
    The last bit tells git to pretend manifest.json was not modified. I'm guessing in the long run you'll find yourself editing the local/remote copies separately (e.g. edit the remote copy directly on Github) so this is not ideal...

    ... Still, better than breaking other people's copies of a repo with local refs.

    Probably not going to use this much at all, where a commit script fixing the local dep. just in time would be more helpful.

    In the grand scheme of things not sure what the "real solution" to this is supposed to be.