- Editado
Can't build a Windows Store App with Unity (Errors)
Hi,
Did anybody ever find a workaround for using Spine to build a Windows Store app. Building to iOS, Android and Windows Phone works fine, but I'm trying to publish a game as a Universal Windows Store app and get the following errors...
Assets\spine-csharp\Atlas.cs(71,42): error CS1502: The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments
Assets\spine-csharp\Atlas.cs(71,59): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'
Assets\spine-csharp\SkeletonJson.cs(76,33): error CS1502: The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments
Assets\spine-csharp\SkeletonJson.cs(76,50): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'
You can recreate this by building any Spine/Unity project and changing the platform to Windows Store.
I'm using Unity 4.5.5 here, but on another machine I'm running the latest version of Unity, Spine, and the Spine plug-ins and have the same issues.
The issue here is to do with StreamReader. Below is the code from the Atlas.cs file. It's the same problem in the SkeletonJason.cs file.
Loading Image
#if WINDOWS_PHONE
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
using (StreamReader reader = new StreamReader(stream))
{
#else
using (StreamReader reader = new StreamReader(path)) { <
---
#endif
try {
Load(reader, Path.GetDirectoryName(path), textureLoader);
} catch (Exception ex) {
throw new Exception("Error reading atlas file: " + path, ex);
}
}
}
#endif
Thanks in advance for your help!
Best wishes,
Ali
Hey Ali,
actually, you can just comment these out in your case. These are part of the generic spine-csharp framework, and are not used by the Unity plugin. The AtlasAsset script uses the Atlas(TextReader reader, String dir, TextureLoader textureLoader) constructor instead, for instance, passing the text from the Unity text asset file.
I've just verified that commenting out the methods
Atlas.Atlas(String path, TextureLoader textureLoader)
SkeletonBinary.ReadSkeletonData(String path)
SkeletonJson.ReadSkeletonData(String path)
makes the Dragon.unity test scene still work fine in Unity 5.0.0f4, and allows you to build Windows Store Universal 8.1 apps.
Cheers!
Nick
Thank you so much, was really struggling with this, but your solution works!
Really appreciate the help. Noticed a few other posts about this, unresolved, so hopefully this'll help them out too.
Once again, really, really appreciate the help. So glad to have this game up and running.