• Runtimes
  • Spine & Unity Windows Store

Hey everybody,

I just tried to add Spine to our Unity Windows Store app with the instructions provided at https://github.com/EsotericSoftware/spi ... pine-unity, and while the game was running fine in the editor, building the player failed. The reason for this is that Unity doesn’t provide the correct compilation symbols for the imported C# scripts.

For me, the following workaround helped successfully building a Windows Store player that passes WACK:

  1. Don’t copy spine-csharp/src to your Unity project as specified by the instructions of the readme file, but instead open the spine-csharp solution file in Visual Studio.
  2. Change target framework of the spine-csharp project to .NET 3.5 in order to be able to use build libraries in Unity.
  3. Create a new Class library (Windows store apps) project (e.g. spine-csharp-windowsstore).
  4. Copy the src folder from spine-csharp to spine-csharp-windowsstore.
  5. In the Properties window of the spine-csharp-windowsstore project, set the assembly name and default namespace of the to the same values as in spine-csharp.
  6. Switch to the Release solution configuration in order to pass the WACK Debug configuration test later.
  7. Add the WINDOWS_STOREAPP compilation symbol to the spine-csharp-windowsstore project.
  8. Build the solution.
  9. Copy the spine-csharp.dll from the bin/Release folder of the spine-csharp project to your Unity Plugins folder.
  10. Copy the spine-csharp.dll from the bin/Release folder of the spine-csharp-windowsstore project to your Unity Plugins\Metro folder. This will make Unity choose the Windows Store-specific implementation of Spine when building the player.

Hope that helps others who are as eager to use Spine on their Windows Store game as we are.

Cheers!

Related Discussions
...

Thanks for sharing! Yeesh those steps are kind of hairy. I wonder why putting the source in your project is not sufficient? I'm not familiar with building for the Windows Store.

I think it's basically because Unity doesn't define the compilation symbols you are using for multi-platform development:

Assets\Spine\spine-csharp\Atlas.cs(74,42): error CS1502: The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments

This line shouldn't be even compiled for Windows Store apps, because of which you already wrapped it with an "#if WINDOWS_STOREAPP".

I chose the above approach with building the whole project into .dlls because I didn't want to figure out all affected parts of the code, but instead rely on your work and use your compilation symbols 😉