How to Make a Unity Package (For the Unity Package Manager)

Let’s say you have a bunch of code you want to drag around with you to every new Unity project, or maybe just the next project you’re doing for the same company. Don’t just copy and paste the same directory over and over again forcing you to also copy changes and updates. Create a package instead! Unity has switched over to a package model for a lot of the engine’s capabilities. And it also allows you to import non-Asset Store packages straight from GitHub or even locally. So how do you take what you have and make it an easily distributable package? Follow these steps. In your Project window, below all your regular files is a Packages folder. Right click on it and select Show in Explorer. In that Packages folder, create a new directory and name it however you like. This will be the root of your package. Do remember that the folder name can not contain spaces. Create a new “package.json” file. This page right here explains everything about the structure of the file. And here is an example file. Back in Unity, your new package should be visible with the name you gave it. Clicking on package file will open it in the Editor UI, allowing you to edit it more conveniently so you don’t have to go back to the JSON. In that Inspector window, you can also easily add Dependencies if your package requires it which is a much easier workflow than typing them out. Continue Reading →


Posted in Practice, Programming, Thinking Out Loud by with comments disabled.