Scott Andrew

Blog

This is an archived blog post that was posted on August 24, 2018.

Fixing common problems with Unity 2D Game Kit tutorial on Mac OSX

(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.

  1. open the Mac OS X Terminal program.
  2. type the following: cd /Applications/Unity/Unity.app/Contents/
  3. Press Enter.
  4. type the following: sudo chown -R $(whoami) Resources
  5. Press Enter.
  6. When prompted, type in the password you use to log in to your computer.
  7. 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.

  1. Open Unity.
  2. Open the Asset Store by pressing Cmd + 9 or going to Window > General > Asset Store in the menu bar.
  3. Search for the 2D Game Kit (it's free) and download it.
  4. (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

  1. 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:
    1. Open the Mac OS X Finder
    2. Press Shift + Cmd + H to open your Home folder.
    3. Press Cmd + J to open the viewing options dialog.
    4. Make sure the "Show Library Folder" option is checked.
  2. 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.
  3. In the menu bar, go to Assets > Import Package > Custom Package... to open the file chooser.
  4. 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.
  5. 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

  1. Open the Mac OS X Finder and navigate to your project location.
  2. In the top-level project folder, navigate to Assets/2DGameKit/Utilities
  3. Delete both the TextMesh Pro folder and TextMesh Pro.meta file by dragging it to the trash.

Install Cinemachine

  1. In the Unity menu bar, choose Window > Package Manager to open the Package Manager dialog.
  2. Click the "All" tab to see all available packages.
  3. 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

  1. In the Unity menu bar, choose Window >TextMesh Pro > Import TMP Essential Resources and allow the import to complete.
  2. Choose Window > TextMesh Pro > Project Files GUID Remapping Tools to open the TMP Remapping Tool.
  3. 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.
  4. If the scan completes and files are found to update, click the "Save Modified Project Files" button to save these updates.

Restart everything

  1. Save your project once more.
  2. Quit and restart Unity.
  3. 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!