Unity Editor supports NPM packages. It is way more flexible solution in comparison with classic Plugin that Unity is using for years. NPM package supports versioning and dependencies. You may update / downgrade any package very easily. Also, Unity Editor has UPM (Unity Package Manager) that makes the process even simpler.
This template repository is designed to be easily updated into a real Unity package. Please follow the instruction bellow, it will help you to go through the entire process of package creation, distribution and installing.
Your package should have unique identifier. It is called a name of the package. It support only limited symbols. There is a sample of the package name.
com.github.your_name.package
- 👉 Instead of the word
packageuse a word or couple of words that explains the main purpose of the package. - 👉 The
nameshould be unique in the world.
For MacOS
For Windows
cd Commands
.\package_rename.bat Username PackageNameFollow the instruction - manual package rename
-
👉 Update
nameSample:
com.github.your_name.packageInstead of the wordpackageuse a word or couple of words that explains the main purpose of the package. Thenameshould be unique in the world. -
👉 Update
unityto setup minimum supported Unity version -
👉 Update
displayName- visible name of the package,version- the version of the package (1.0.0),description- short description of the package,author- author of the package and url to the author (could be GitHub profile),keywords- array of keywords that describes the package.
❌ NO
- 👉 Delete
Assets/root/Testsfolder - 👉 Delete
.github/workflowsfolder
✅ YES
-
👉 Make sure you executed
package-renamescript from the step #2. If not, please follow manual package rename instructions -
👉 Add GitHub Secrets
At the GitHub repository, go to "Settings", then "Secrets and Variables", then "Actions", then click on "New repository secret"
- Add
UNITY_EMAIL- email of your Unity ID's account - Add
UNITY_PASSWORD- password of your Unity ID's account - Add
UNITY_LICENSE- license content. Could be taken fromUnity_lic.ulffile. Just open it in any text editor and copy the entire content- Windows: The
Unity_lic.ulffile is located atC:/ProgramData/Unity/Unity_lic.ulf - MacOS:
/Library/Application Support/Unity/Unity_lic.ulf - Linux:
~/.local/share/unity3d/Unity/Unity_lic.ulf
- Windows: The
- Add
Unity guidelines about organizing files into the package root directory
<root>
├── package.json
├── README.md
├── CHANGELOG.md
├── LICENSE.md
├── Third Party Notices.md
├── Editor
│ ├── [company-name].[package-name].Editor.asmdef
│ └── EditorExample.cs
├── Runtime
│ ├── [company-name].[package-name].asmdef
│ └── RuntimeExample.cs
├── Tests
│ ├── Editor
│ │ ├── [company-name].[package-name].Editor.Tests.asmdef
│ │ └── EditorExampleTest.cs
│ └── Runtime
│ ├── [company-name].[package-name].Tests.asmdef
│ └── RuntimeExampleTest.cs
├── Samples~
│ ├── SampleFolder1
│ ├── SampleFolder2
│ └── ...
└── Documentation~
└── [package-name].md
- Update the
README.mdfile (this file) with information about your package. - Copy the updated
README.mdtoAssets/rootas well.
⚠️ Everything outside of therootfolder won't be added to your package. But still could be used for testing or showcasing your package at your repository.
- Deploy to OpenUPM (recommended)
- Deploy using GitHub
- Deploy to npmjs.com
When your package is distributed, you can install it into any Unity project.
Don't install into the same Unity project, please use another one.
-
Open a command line at the root of Unity project (the folder which contains
Assets) -
Execute the command (for
OpenUPMhosted package)openupm add YOUR_PACKAGE_NAME


