Definition: Unity package is nothing but “.zip” format for the unity where you can directly “zip” and “unzip” your following game asset from the editor. Let us consider the fact that your friend sends you willing to send you a 100 sprites of enemy along with the script. He will just create those asset to “.unityPackage” and send that file to you which will be extract to your “Asset” folder which is displayed as a “Project” view in the “Unity Editor”.
We will show you how you can create and extract a “.unityPackage” in “Unity Editor”.
- Let us consider that we want to create our “Art” folder from “Project” view to a “.unityPackage”. I will show you the both way on how you can export a “.unityPackage”.
- You can either “Select” the folder that you want to export, and “Right Click” on it. Where you can find an option call “Export Package..”.
- Here, you can see that all the items are the “Art” folder has been selected to be exported in the “.unityPackage”. you can deselect any item if you wish not to be include in the “.unityPackage”. Now let’s create the “Export” button to export our art asset.
- It will ask you to set a destination where it will export the “.unityPackage”. give your package a name and click on the “Save” button.
- As you can see, that my “ArtAsset.unityPackage” is now ready to port on any unity game.
- Let us consider that we want import the “ArtAsset.unityPackage” to our new project in unity. To do that, just create a new project in unity. ( I am skiping this section as I do believe you guys can create a project in unity).
- Now go to the “Assets” -> “Import Package” -> “Custom Package..”.
- Now select your “ArtAsset.unityPackage” and click “Open” button.
- Now it will show you the list of all the content of the following package, where you can select/deselect any items you wish to add, and what are the items that are new in your project (the reason why it’s showing “NEW” it’s because the following item is not in the “Asset” folder, if it doesn’t show “NEW” means, the item that you want to add is already in the “Asset” folder. By importing again, it will just override the file). Now, let’s click on the “Import” button to import all the asset to our “Project View” in “Unity Editor”.
- It will take few seconds (Based on the asset size) to load all the item of the “.unityPackage”. Here you can see in our “Project View” that all the asset has been loaded successfully.
# The reference of the documents are taken from the “Unity – Documentation”.
Mentor at Coursera