
Saving scenes and projects
As in any other program, we need to save our progress. The difference here is that we don't have just one giant file with all the project Assets, but several files for each Asset.
In this section, we will cover the following concepts related to saving:
- Saving our changes
- Project structure
Saving our changes
Let's start saving our progress by saving the scene, which is pretty straightforward. We can simply go to File | Save Scene or press Ctrl + S (command + S on a Mac). The first time we save our scene, a window will just ask us where we want to save our file, and you can save it wherever you want inside the Assets folder of our project, but never outside that folder. That will generate a new Asset in the Project window: a scene file, as illustrated in the following screenshot:

Figure 3.36 – Scene files
We can create a folder to save our scene in that dialog, or, if you already saved the scene, you can create a folder using the Create | Folder option in the Project window and drag the created scene to that folder. Now, if you create another Scene with the File | New Scene menu option, you can get back to the previous scene just by double-clicking the Asset in the Project window.
This only saved the Scene, but any change in Prefabs and another kind of Assets are not saved with that option. Instead, if you want to save every change on the Assets except Scenes, you can use the File | Save Project option. It can be a little bit confusing, but if you want to save all your changes, you need to both save the scenes and the project, as saving just the project won't save the changes on Scenes. Sometimes, the best way to be sure everything is saved is just by closing Unity, which is recommended when you try to move your project between computers or folders. Let's talk about that in the next section.
Project structure
Now that we have saved all our changes, we are ready to move the project between computers or to another folder (if you someday need to). You can close Unity to make sure everything is saved and just copy the entire project folder. If you don't remember where you saved your project, you can just right-click the Assets folder in the Project window and select Show in Explorer (Reveal in Finder on a Mac), as illustrated in the following screenshot:

Figure 3.37 – Locating the project folder
Let's take the opportunity, now that we are in the project folder, to explore a little bit. We will find several folders and files in a full project, but not all the files are necessary to copy in order to move the project elsewhere. The most important folders are Assets, ProjectSettings, and Packages. These folders can be seen in the following screenshot:

Figure 3.38 – Project folder structure
Assets is where all our scenes, Prefabs, and other Asset files will live, so that folder and all its content is indispensable, including those metafiles automatically created per Asset. The ProjectSettings folder contains several configurations of different Unity systems we will fiddle with later in this book, but even if we didn't change any settings, it's always a good idea to bring that folder with us. Packages are a Unity feature that allows you to install official and custom Unity packages or plugins that extend the engine capabilities, this being a new different version of what the .unitypackage files used to be, but let's discuss that later. So far, it's important to note that that folder will have settings about which packages our project is using, so remember to also bring that one with you.
No other folders/files are necessary because some are them are temporary and others can be regenerated, such as Library, where all the converted versions of our Assets will live. By converted, we mean externally generated files, such as 3D models, images, sounds, and so on. Unity needs to convert those files to a Unity-compatible format. The original will live in Assets and the converted ones in Library so that they can be easily regenerated if necessary. Later, in Chapter 5, Importing and Integrating Assets, we will discuss integrating externally generated content.
Now, let's imagine you have compressed those three folders, copied them to a flash drive, and then decompressed the folders into another computer. How can we open the project again? As you can see, a project doesn't have a project file or anything like that—it's just a bunch of folders. In order to open a project, the easiest way would be to find a scene file in the Assets folder and double-click it so that Unity will open the project in that scene. Another option would be to use the Add button in Unity Hub and find the project folder (the one that contains the Assets folder). So, we will add that project to the list of our computer projects, and later, we can just click the name in that list to open it. The following screenshot illustrates this:

Figure 3.39 – Reopening a project
Now, we have all the base Unity knowledge we need in order to start ping into how to use the different Unity systems so that we can start creating a real game! Let's do that in the next chapter!