Happy New Year! This year we’re starting off strong with a Feature Friday dedicated to something that is becoming increasingly more used in Unity – Packages.
This week we’ll learn:
- What are Packages in Unity?
- How to Use Packages in Your Projects
- How to Create Your Own Custom Packages
And as always, I’ll be featurning some other Unity content at the end of this article. This week I am featuring a livestream from two very experienced Unity developers with the same first name.
It’s pretty long, but you can listen to it in the background like a podcast when you are doing chores or playing games.
Let’s jump on in!
1. What are Packages in Unity?
Unity has had the concept of packages for a long time now, however in recent years, Unity is becoming increasingly more reliant on packages.
In the past, Unity updates contained major additions and features to the Unity engine. With the introduction of Unity 2020, they changed this up.
Now, updates to the Unity engine are focused on the actual Unity editor interface and the back end of how games are compiled.
More of the interesting features you use when creating games are developed separately in packages.
This serves two purposes:
- This decreases the amount of things included with Unity by default. If you are making a simple game, it is a bit of a waste for Unity to include all this extra stuff that you will never use.
- This also means that features can be developed on their own schedule and aren’t dependent on when new versions of the Unity engine are released.
Because these packages are developed separately from the game engine, they can be made available in beta forms for testing and can be released as a verified package when they are ready – not just when a new version of the engine is going to be released.
But packages can contain anything in Unity, not just features. You’ll often see packages as a way to pass around asset files for projects.
When you get something from the Unity Asset Store, you’ll download it in a package and you can choose what components of the package to import into your project.
2. How to Use Packages in Your Projects
Using packages in the traditional sense is incredibly easy.
If you have a .unitypackage file, you can go into Unity and navigate to Assets > Import Package > Custom Package… then locate the .unitypackage file you wish to import.
After you click on open, a window will pop up prompting you to select the assets you wish to import.
For ease of use, it is best to import all assets in a project to avoid any conflicts. But if there are a lot of assets and you only need a few, you can select those few – just be aware that you may need to manually import additional assets from the package to resolve any dependency issues.
Then just click import and the assets will be brought right into your Unity project.
As of Unity version 2020, packages downloaded from the Asset Store or extensions to the Unity engine are imported into your project via the package manager.
To open it, just go to Window > Package Manager to open it up.
Here you can select if you want to list out packages from the Unity Registry (standard extensions of the game engine) or My Assets which are ones you purchased from the Unity Asset Store.
Simply navigate to a package you wish to import then click the download and import buttons and you’ll see a similar import window prompting you to import select assets into your project.
If you do want a video overview of how to use the Unity Package Manager, you can see that here:
3. How to Create Your Own Custom Packages
Creating your own .unitypackage files to share assets is extremely simple as well.
Just go up to Assets > Export Package… then select all the files and assets you wish to include in the package.
Note, if you select the “Include Dependencies” check box, it will automatically include any scripts or other assets required by the assets you had selected.
So if you wanted to export a package of a player prefab, selecting the Include Dependencies check box would also include the player’s model, character controller script, and anything else on the player prefab.
Then just click “Export…” and choose where you want to save the .unitypackage file.
Creating your own package to be used in the package manager is similar but there are some additional steps that you can see here: https://docs.unity3d.com/Manual/CustomPackages.html
Also if you do intend on sharing or selling your assets on the Unity Asset Store, here is a video I made that shows you how to upload your assets to the Asset Store:
Featured Unity Video of the Week
This week I am featuring a livestream from earlier this year by Jason Wiemann and Jason Storey. They are both very experienced Unity developers and know lots of the ins and outs of Unity game development.
This stream in particular is dedicated to things every Unity developer should know about the Unity game engine.
It is a longer format video, but it is perfect to listen to as a podcast when you are doing other things.
There is so much good knowledge in here and you’ll learn so much about how to use Unity over the course of this stream. I highly recommend checking it out!
Wishing you all the best in the new year! I hope that you continue to learn more about the Unity game engine along with me in order to make better games in 2021.
Anyways I hope you are all staying well, and as always, keep on creating!
Turbo Makes Games