Build Error! :(

Hi,
my game works in Unity Game-Mode but when I want to build it the following error appears:

SpritePacker failed to get types from UnityEditor.Android.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Error: The classes in the module cannot be loaded.
UnityEditor.Sprites.Packer:GetSelectedPolicyId()

What I tried:

  • Other projects still work, it’s just one project with this error so it’s not a Unity bug
  • I tried to change into .NET 2.0 at the player settings
  • I downloaded the file UnityEditor.Android.Extensions.dll
  • I deleted all assets in a project copy

Nothing of this helps, has anyone an idea please?

You can see the source code that produces this error in this decompiled Unity code, line 128.

I believe that the SpritePacker error indicates that Assembly.GetTypes() failed (line 115), which means that some dependency of UnityEditor.Android.Extensions is missing (or of whatever is in the same place in the error message). UnityEditor.Android.Extensions is not itself missing.

What dependency is missing? The error doesn’t say, frustratingly.

But I resolved my version of this error when I tried to build the project for iOS, at which point I got an error that told me exactly what was missing. Maybe that will work for others.