• Bugs
  • Unity - Incorrect arguments used in AtlasAsset.cs?

Got a bit of a strange problem (aren't they all strange though? 😉). When importing the needed files into an existing project, it fails to compile with the following errors:

Assets/spine-unity/AtlasAsset.cs(64,114): error CS1502: The best overloaded method match for `Spine.Atlas.Atlas(System.IO.TextReader, string, Spine.TextureLoader)' has some invalid arguments

Assets/spine-unity/AtlasAsset.cs(64,114): error CS1503: Argument #3' cannot convertMaterialsTextureLoader' expression to type `Spine.TextureLoader'

First thought would be that this is conflicting with something in my project. Which chances are it is - because when I import the Spine files into a new project, the above error doesn't occur. However, in trying to track down the issue, the code being used is all within Spine or within Unity's main .NET levels. So I'm unsure of where to look next to fix the problem.

Reviewing the code, this is the part in AtlasAsset.cs that the above error occurs on:

atlas = new Atlas(new StringReader(atlasFile.text), "", new MaterialsTextureLoader(this));

Best I can tell, the Atlas object wants an object of type TextReader, not StringReader. I would go through and edit everything to function correctly, however I would prefer to work out the actual issue with you guys rather than coming up with a hack solution. 🙂

Any pointers as to how to correct this?

Thank in advance!

Related Discussions
...

Uhhh what... ?

What version of Unity are you using?

When did you download the Spine Unity runtime?

Unity 4.5.3f3, and I just downloaded it today. I've tried both the one from GIT and the .unitypackage version.

Hello, I'm the one outputting the Altas from Spine for Dave. Thought I'd drop the log here see if it helps

Spine Launcher 1.9.00-full
Windows 7 x86 6.1
Java 1.7.0-u6-unofficial Oracle Corporation
OpenJDK Server VM

incidentally I'm actually running 2.0.21 essential....dont know why it would say 1.9...but it does

I'm actually not even getting to the point of accessing those files. This is just from inputting the Spine runtime into Unity.

Well... thats weird.. and a first.

Do you have any custom global scripting defines somewhere?

Happen to have 2 instances of the Spine runtime of different versions and its just tripping up on the other one?

Uh... yea. If you import the spine-unity package into a blank unity project does it compile?

In a blank project it loads and compiles just fine.

Verifying things in my project...

  • There is only one instance of Spine in the project.
  • I do have a number of other assets in there, some of which do have global scripting defines.

However, in double-checking each class used there in the problem code, I'm not seeing any duplications of classes in the project.

Mm well... the problem isn't in the Spine Unity runtime then. There's a conflict somewhere.

Do you have WINDOWS_STOREAPP or WINDOWS_PHONE defined anywhere?
(speaking about Compiler Directives)

Other thought is do you have any other global classes called Atlas? :/

Updated to the latest Spine-C# too?

Mitch a écrit

Mm well... the problem isn't in the Spine Unity runtime then. There's a conflict somewhere.

Do you have WINDOWS_STOREAPP or WINDOWS_PHONE defined anywhere?
(speaking about Compiler Directives)

Other thought is do you have any other global classes called Atlas? :/

Only one class called Atlas and that is in Spine. Only Spine defines WINDOWS_STOREAPP and WINDOWS_PHONE.


Pharan a écrit

Updated to the latest Spine-C# too?

I've tried both the Spine-C# that was on GIT, and the one inside the spine-unity.unitypackage. Both had the same problem.


Figured it out! The problem was the NDATA plugin. It also has a class called TextureLoader, which was conflicting with Spine's TextureLoader. I'm thankfully not using NDATA yet in this project so I just removed it.

Thanks everyone!!

Ehm, isn't TextureLoader in the spine namespace? Did Unity really break namespaces? :drunk:

TextureLoader IS in the spine namespace, yea. So I'll admit the issue confused me a little bit... removing NDATA fixed it, but yea... it shouldn't have been the problem, yet it was. =/

I wonder about those Unity guys sometimes. 😉 Eg, what is with the "Animation can't be used as a component" warning because Spine has a class named Animation? First, namespaces. Second, Spine's Animation isn't a component, so can't be used as a component anyway. 🙂

un an plus tard

Sorry to bump a months-old thread, but I have exactly the same issue now, and the same conflict with NDATA plugin. (Only one google result when searching for that compiler error in the first post, and it's this thread!)

Unfortunately I'm actually using NDATA in my project, and need to find some way to make it co-exist with spine... Any ideas? Unity 5.1.3, and the latest spine runtimes as of today.

Pick one and refactor it to _TextureLoader or somehting :/