The secret to publishing UPM package to the Asset Store
Tags: unity3d, gamedev, assets, npm
Published: 2024-03-04 12:13:30

## 📘 Unity native solution

In 2018, Unity's developers released a centralized repository for iterative updates to their Editor engine and extensions called UPM - Unity Package Manager.

Later, third-party services appeared through which UPM packages were distributed:

<ul>
  <li><a href="https://openupm.com/">OpenUPM</a></li>
  <li><a href="https://www.npmjs.com/">NpmJs</a></li>
  <li><a href="https://verdaccio.org/">Verdaccio</a></li>
</ul>

Separately, [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) can be highlighted, which runs the NuGet client within the Unity editor.

Despite this, more than 93 thousand assets and extensions have been published on the Asset Store, but it does not officially offer UPM package downloading functionality.

## 🎯 Seeking a solution

[Asset Store Tools](https://assetstore.unity.com/packages/tools/utilities/asset-store-publishing-tools-115) v11.3.1, allows you to download assets from the following sources:

<ul>
  <li>From Assets Folder</li>
  <li>Pre-exported .unitypackage</li>
</ul>


![upload-type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/un1ozvh3d0cwrllxrzc1.png)

Looking through the sources of the Asset Store Tools, we see the experimental functionality wrapped in the<br>
 `#if UNITY_ASTOOLS_EXPERIMENTAL` directive:

![experimental-define](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ierqdgljcaffdmq0i52u.png)

The functionality has already been on the Unity side, but it is not available to third-party developers:

![define-example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdadm6r9hzg3abtjh8lx.png)

Meanwhile, Unity Technologies developers load their own assets in the form of UPM packages:

![asset-tools-hierarchy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zajelqw0xlt219upu3e6.png)

To achieve a similar result, follow these steps:

_1_ - Create a draft package using the [Unity Publisher Portal](https://publisher.unity.com/packages):

![draft-package](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5b54ruaifk4em2cog80.png)
![assets-store-uploader](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7otuvup1cwd7vl8zpag.png)

_2_ - Add the value `UNITY_ASTOOLS_EXPERIMENTAL` to *Project Settings > Scripting Define Symbols*:

![scripting-define-symbols:](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8t9qvsd2w1xdvcs3us4n.png)

_3_ - After compilation is complete, select the option to load the local UPM package and specify the package path:

![package-path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txq9m0neeem5jzaz6xxz.png)

_4_ - Click the `Upload` button and 🎉:

![smart-importer-preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g5dnhg2k3ju8tvnf8nyq.png)



## 💻 Conclusion

The type of download using UPM packages is suitable for assets or tools that have version control and configure dependencies between packages.

This results in a uniform asset structure for the Unity Package Registry and Asset Store.

In future Unity releases, it is likely that an open solution will be published for publishers.

## 🎁 Helpful Links

[Guide](https://youtu.be/-W7BtzhHUpA)

[Smart Importer](https://github.com/dreamcodestudio/com.dreamcode.editor.smart-importer)

[Asset Store Tools](https://github.com/Unity-Technologies/com.unity.asset-store-tools)

[Unity’s Package Manager](https://docs.unity3d.com/Manual/Packages.html)