Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Install Converters via Git in UPM

Kalle Jillheden edited this page May 5, 2020 · 5 revisions

Unity Package Manager, or UPM for short, is Unity's new solution for managing packages so they don't need to be included inside the /Assets folder.

Have a look at the Unity Package Manager docs for more info.

This guide shows how to install the jilleJr/Newtonsoft.Json-for-Unity.Converters project using Git via UPM.

The converters project contains lots of converters to be able to successfully read and write JSON data that uses Unity types, such as Vector3, Quaternion, Bounds, LayerMask, et.al.

Prerequisites

  1. Requires Unity Editor 2018.1 or above, as UPM was first shipped with 2018.1.

  2. Git installed on your machine. See download instructions here: https://git-scm.com/downloads

  3. You already have installed Newtonsoft.Json installed to your Unity project.

    You may visit the any of the "Getting started > Install Newtonsoft.Json-for-Unity" wiki pages to install that beforehand.

Finding your version

No matter if you're installing or updating, you will be wanting to know which version you will install beforehand.

  1. First go to the list of tags: https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters/tags

  2. To install to Unity using UPM via Git, you want to find a tag that starts with upm/*. For example upm/1.0.0

Installing the package

  1. First find the version you wish to install as instructed above.

  2. Open <project>/Packages/manifest.json, add the package in the list of dependencies.

À la:

{
  "dependencies": {
    "jillejr.newtonsoft.json-for-unity.converters": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters.git#upm/1.0.0",

    /* ... rest of Unity packages ... */
  }
}

Done!

Updating the package

  1. First find the version you wish to update to as instructed above.

  2. Open <project>/Packages/manifest.json, change the version of the package in the list of dependencies by changing the value after the pound sign. For example, from #upm/1.0.0 to #upm/1.1.0.

  3. Then also remove the version lock for the package to force UPM to fetch the new version of the package.

Sample changeset:

@@ Packages/manifest.json @@
{
  "dependencies": {
-    "jillejr.newtonsoft.json-for-unity.converters": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters.git#upm/1.0.0",
+    "jillejr.newtonsoft.json-for-unity.converters": "https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters.git#upm/1.1.0",

    /* ... rest of Unity packages ... */
  },
  "lock": {
-    "jillejr.newtonsoft.json-for-unity.converters": {
-      "hash": "9b9871e395be2f53e53f830af9ab586ee6e1ee3d",
-      "revision": "upm/1.0.0"
-    }
  }
}