(Updated 2018-07-30)
I've been tinkering around with the Unity3D game engine and running into all kinds of weird problems with their beginner tutorials. Most of the issues are configuration problems that a newbie would never figure out. Unfortunately, many solutions are buried deep in ridiculous catch-all forum threads with no way to pin, upvote or otherwise surface good answers to Google.
I'm using this post to record what I've learned and hopefully save someone from frantic searching.
This post deals specifically with problems using the 2D Game Kit tutorial with Unity 2018 on Mac OS X (sorry Windows users!).
Problem: Failed to change file flags (errno:13)
Error case: After installing Unity 2018, the project fails to run with the following errors (or similar errors) in the console:
Failed to change file flags for '/Applications/Unity/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.modules./physics/package.json.meta'.errno:13
The file path might be slightly different than the one described above, and it's likely you'll see more than just one of these.
Solution
"errno:13" is Python's way of saying "permission denied." You need to change the permission settings for some of the Unity system files. Here's how:
The following is modified from this solution.
- open the Mac OS X Terminal program.
- type the following:
cd /Applications/Unity/Unity.app/Contents/
- Press Enter.
- type the following:
sudo chown -R $(whoami) Resources
- Press Enter.
- When prompted, type in the password you use to log in to your computer.
- Quit and restart Unity.
These errors should now be fixed!
Problem: Failed to import package
Error case: in Unity 2018 the project eventually imports, but fails to open with the following error in the console:
Failed to import package /Users/<username>/Library/Unity/Asset Store-5.x/Unity Technologies/Sample Projects/2d-game-kit.unitypackage
Depending on your setup, the path might be slightly different than the one above, but it's likely the same root cause: your default Unity 2018 setup needs some additional configuration to work with the 2D Game Kit i
Here are the steps I used to fix this.
Step One: Download the 2D Game Kit
I found it's easier to download the kit directly from the Unity Asset Store instead of import it from the Learn screens, which are weird and don't always seem to work.
- Open Unity.
- Open the Asset Store by pressing Cmd + 9 or going to Window > General > Asset Store in the menu bar.
- Search for the 2D Game Kit (it's free) and download it.
- (Optional) You can switch to the Download Manager to view details about the download by clicking the inbox icon to the right of the Home icon.
The downloaded file should be available on your computer at this location:
/Users/<username>/Library/Unity/Asset Store-5.x/Unity Technologies/Unity EssentialsSample Projects/2D Game Kit.unitypackage
That last part of the filepath is not a typo. The folder name is actually "Unity EssentialsSample Projects" because the slash is removed.
Step Two: Import the game kit
- Make sure your Library folder is visible to the Finder, or else you won't be able to find the game kit file. To make the Library folder visible:
- Open the Mac OS X Finder
- Press Shift + Cmd + H to open your Home folder.
- Press Cmd + J to open the viewing options dialog.
- Make sure the "Show Library Folder" option is checked.
- In Unity, create a new project by going to File > New Project and take note of the project location because we'll need to find it later.
- In the menu bar, go to Assets > Import Package > Custom Package... to open the file chooser.
- Navigate to the game kit file at the location mentioned in Step One and import it. Importing will take several minutes. Wait for it to finish. When it's done, your project will still appear empty. That's okay, we're going to fix this.
- Save the project. (Don't skip this!)
Step Three: Fix stuff
The following is modified from the solution posted here.
Delete current version of TextMesh Pro
- Open the Mac OS X Finder and navigate to your project location.
- In the top-level project folder, navigate to Assets/2DGameKit/Utilities
- Delete both the TextMesh Pro folder and TextMesh Pro.meta file by dragging it to the trash.
Install Cinemachine
- In the Unity menu bar, choose Window > Package Manager to open the Package Manager dialog.
- Click the "All" tab to see all available packages.
- Find the Cinemachine package in the list on the left and install the latest version by clicking the "Install" button in the upper right corner.
Re-install TextMesh Pro stuff
- In the Unity menu bar, choose Window >TextMesh Pro > Import TMP Essential Resources and allow the import to complete.
- Choose Window > TextMesh Pro > Project Files GUID Remapping Tools to open the TMP Remapping Tool.
- Click "Scan Project Files" to begin scanning for files that used the older version of TextMesh Pro. It's likely you won't find any.
- If the scan completes and files are found to update, click the "Save Modified Project Files" button to save these updates.
Restart everything
- Save your project once more.
- Quit and restart Unity.
- Re-open your project.
If everything worked, you should now see the additional menu items Cinemachine, Kit Tools and Tutorial in the Unity menu bar.
Follow the instructions here to add your first scene to your project!