Hello Guest

Author Topic: URGENT: with spine with 2dtk in unity problem.  (Read 19354 times)

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
URGENT: with spine with 2dtk in unity problem.
« on: May 27, 2013, 05:06:15 am »
This is gonna be a long story.

So basically I'm trying to use spine (the skeleton tool under progress, see: http://esotericsoftware.com/) with 2dtk in unity. You probably know spine since the developer said he has discussed things with you regarding the integration before. And I'm having a problem scaling with the skeletong by adjusting the orthosize and target height in sprite collection editor (I'm not using 2DTK camera by the way)

I have already seek support from spine forum but didn't get much luck, still a long story. Please read this link first to get an idea of the situation.

http://esotericsoftware.com/forum/viewtopic.php?f=3&t=713  (please read it carefully as it contains a lot of information, you might go back to look this link if you see things I mentioned before that you need to get a context with)

After reading this you now know I'm having a werid problem that others didn't encounter, and the rebuilding index problem which I have file a report to unity. I don't know if this maybe something 2dtk can help with. You can try downloading the 2dtk runtime on github page: https://github.com/EsotericSoftware/spine-runtimes and create a example to see if the scaling works. From the post you can tell they have committed a new example but that still didn't work for me and my example simple don't show skeleton for them, which confuses me. I have send 2 zip folders to your support email, one is the old project i have (created from scratch tho), another is their newly commited example. Does these two works for you about scaling? What unity version are you using? I'm using 4.1.2f and this is my last resort of seeking help. I'm been stuck on this for more than a week and I need to get a demo done in a month, very urgent.

Please investicate this issue and see if there is anything you might be able to help.

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #1 on: May 27, 2013, 12:21:34 pm »
There is an issue with Unity 4.1.x and 2D Toolkit 1.92 final.
Update to the 1.92 + patch 1 to fix the issue with the progress bar.

After updating, restart unity, and 2D Toolkit > Rebuild Index. You should be able to create sprites, etc. after that.

Please check the releases forum after updating Unity etc. Unity can and often break things which we rely on without warning - but we post fixes as soon as we find/resolve em.

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #2 on: May 27, 2013, 01:02:58 pm »
There is an issue with Unity 4.1.x and 2D Toolkit 1.92 final.
Update to the 1.92 + patch 1 to fix the issue with the progress bar.

After updating, restart unity, and 2D Toolkit > Rebuild Index. You should be able to create sprites, etc. after that.

Please check the releases forum after updating Unity etc. Unity can and often break things which we rely on without warning - but we post fixes as soon as we find/resolve em.



This is all I see from the update window, I can't find 1.92+ patch, only a few beta patches

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #3 on: May 27, 2013, 01:06:59 pm »
Maybe it wasn't updated and/or lost during the server migration. You can get it here. Its on this forum.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1398.0.html

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #4 on: May 27, 2013, 01:22:57 pm »
Maybe it wasn't updated and/or lost during the server migration. You can get it here. Its on this forum.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1398.0.html

I just updated, I imported both 2dtoolkit1.92final_patch1.unitypackage and 2dtoolkit1.92final_patch1_src.unitypackage. After importing I restarted unity and rebuilt index, but it didn't solve my problem. After i change the atlas unity still keeps rebuilding the index.

This video shows the bug I'm experiencing. It is recorded before the update, but they behave exactly the same.
http://screencast.com/t/K12z5fTcJi
« Last Edit: May 27, 2013, 01:25:30 pm by ryf9059 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #5 on: May 27, 2013, 01:33:41 pm »
I saw the video, and I saw it in your project. I upgraded, rebuilt index and it works fine for me now in your project. You know, where you have the spineboy tk2d Skeleton and the child sprite, changing it to the spineboy atlas actually does work fine.
I've emailed you a zip of the project which works.

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #6 on: May 27, 2013, 01:38:55 pm »
I saw the video, and I saw it in your project. I upgraded, rebuilt index and it works fine for me now in your project. You know, where you have the spineboy tk2d Skeleton and the child sprite, changing it to the spineboy atlas actually does work fine.
I've emailed you a zip of the project which works.


It worked for me now as well, thanks. But why is that? Do I need to delete the old 2dtk folder before upgrading? I just imported them.

Plus, this didn't not solve the problem of changing ortho size tho, the spineboy size keeps unchanged.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #7 on: May 27, 2013, 01:51:24 pm »
You don't need to delete before upgrading. Not sure why it worked for me and not you, but it works now ;)

I don't know about the ortho size with the spineboy - I didn't write the Spine integration code, so I couldn't really help you with that. I think its removing the ortho size scale from the sprites themselves, but I couldn't tell you that for certain. Probably best to speak to the author of the integration.

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #8 on: May 27, 2013, 01:59:30 pm »
You don't need to delete before upgrading. Not sure why it worked for me and not you, but it works now ;)

I don't know about the ortho size with the spineboy - I didn't write the Spine integration code, so I couldn't really help you with that. I think its removing the ortho size scale from the sprites themselves, but I couldn't tell you that for certain. Probably best to speak to the author of the integration.

Because the scaling works for them but not me :( I already asked the developer of spine and the scaling was working for them.
I hate this kind of bug, not sure if this is because of a unity problem.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #9 on: May 27, 2013, 02:03:44 pm »
You don't need to delete before upgrading. Not sure why it worked for me and not you, but it works now ;)

I don't know about the ortho size with the spineboy - I didn't write the Spine integration code, so I couldn't really help you with that. I think its removing the ortho size scale from the sprites themselves, but I couldn't tell you that for certain. Probably best to speak to the author of the integration.

Because the scaling works for them but not me :( I already asked the developer of spine and the scaling was working for them.
I hate this kind of bug, not sure if this is because of a unity problem.

No, it doesn't. The skinned sprite created by the spine integration doesn't use the scale, just the UVs from the atlas. Just tick Use tk2dCamera in the sprite collection and the sprites will then be the same size.

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #10 on: May 27, 2013, 02:16:39 pm »

No, it doesn't. The skinned sprite created by the spine integration doesn't use the scale, just the UVs from the atlas. Just tick Use tk2dCamera in the sprite collection and the sprites will then be the same size.

But I remember there is a bug with unity for 2dtk camera in which it only shows part of the game view? I remember I even made a post in this forum about this. (http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1481.msg7131.html#msg7131)

Since it's inconvenient with that perspective and I'm not used to it that's why I decide to just use normal camera and enter the ortho size and target height instead. And I might also need to change the camera size in the game later so another reason not to use 2dtk camera. But presumably this two cameras should work the same as long as the correct target height and ortho size is entered isn't it? The Spine authore said both camera works for him
« Last Edit: May 27, 2013, 02:20:49 pm by ryf9059 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #11 on: May 27, 2013, 02:21:29 pm »
Both work, you just have to set the sizes correctly.

With the tk2dCamera, there is a special preview window which shows you the correct preview. The bug in Unity should be fixed in 4.2 and the normal camera preview should appear correct in there too.

At the end of the day its just down to scales. With a normal ortho camera to get the same scale as a tk2dCamera, set the ortho size in the camera to the half the resolution height. Eg. for 1024x768, set it to 384.

Or for a normal camera, take the spine sprite and scale it down appropriately.

ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #12 on: May 27, 2013, 02:33:58 pm »
Both work, you just have to set the sizes correctly.

With the tk2dCamera, there is a special preview window which shows you the correct preview. The bug in Unity should be fixed in 4.2 and the normal camera preview should appear correct in there too.

At the end of the day its just down to scales. With a normal ortho camera to get the same scale as a tk2dCamera, set the ortho size in the camera to the half the resolution height. Eg. for 1024x768, set it to 384.

Or for a normal camera, take the spine sprite and scale it down appropriately.


Half? i remember it should be 768 since it works for me at full height, in fact, you mentioned it before

"Eg.
In sprite collection, set target resolution height = 640, ortho size = 10

In your game window, create a camera, set to orthographic. Set Orthographic size = 10. If your game is running at 960x640 or indeed any other resolution with a 640 height (1024x640, 2046x640, ...) then your sprites will be pixel perfect when the scale on them is 1,1,1. No need to click 1:1, or indeed anything else."

This is quoted from you in my previous post about 2dtkCamera...

And in fact from the video you saw no matter what size I choose it has no effect at all. And I'm a bit confused about your explanation of "The skinned sprite created by the spine integration doesn't use the scale, just the UVs from the atlas." How does this explain the bug I'm having?

So confused :(
« Last Edit: May 27, 2013, 03:13:26 pm by ryf9059 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #13 on: May 27, 2013, 02:52:47 pm »
1. The skinned mesh generated by the spine integration uses 1 world unit per pixel and ignores the size set in the sprite collection. I didn't write this, nor do I have anything to do with it, so I can't really advise you on what you need to do to make it change size when you change the sprite collection settings.

2. Since the spine skinned mesh doesn't change size based on the sprite collection settings, you should use a camera in Unity that works with it instead.

3. The advice from before was for tk2d sprites, with an ortho camera. That still stands, but your request now has nothing to do with that, as the spine mesh is NOT a tk2d sprite. Its a Spine Unity mesh, that uses the tk2d atlas. Thats it.

4. So to make this pixel perfect - since you don't know how the spine stuff works, use a tk2dCamera. The spine skinned mesh will be pixel perfect in there.


Or if you don't want to use tk2dCamera, set up an ortho camera like I said before: orthographic size set to 1/2 of resolution height. This will make the ortho camera use the same scale sprites as a tk2dCamera.This advice is specific to the issue you're having here. You don't want to use the tk2dCamera, so use an ortho camera that uses the same scale instead.




ryf9059

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: URGENT: with spine with 2dtk in unity problem.
« Reply #14 on: May 27, 2013, 03:34:04 pm »
1. The skinned mesh generated by the spine integration uses 1 world unit per pixel and ignores the size set in the sprite collection. I didn't write this, nor do I have anything to do with it, so I can't really advise you on what you need to do to make it change size when you change the sprite collection settings.

2. Since the spine skinned mesh doesn't change size based on the sprite collection settings, you should use a camera in Unity that works with it instead.

3. The advice from before was for tk2d sprites, with an ortho camera. That still stands, but your request now has nothing to do with that, as the spine mesh is NOT a tk2d sprite. Its a Spine Unity mesh, that uses the tk2d atlas. Thats it.

4. So to make this pixel perfect - since you don't know how the spine stuff works, use a tk2dCamera. The spine skinned mesh will be pixel perfect in there.


Or if you don't want to use tk2dCamera, set up an ortho camera like I said before: orthographic size set to 1/2 of resolution height. This will make the ortho camera use the same scale sprites as a tk2dCamera.This advice is specific to the issue you're having here. You don't want to use the tk2dCamera, so use an ortho camera that uses the same scale instead.

Thanks for the answer! 2dtk camera does work for me (it's having weird perspective tho, but at least i see the pixel perfect result)

As for ortho camera, you mean set the ortho size of the camera itself but not the target ortho size in sprite collection editor? I can't change the ortho size of the camera since in my game there are other sprites in the backgroun and they are working correctly, changing ortho size will break that relation. I understand you are advising regarding this specific issue, but I do need to put the skeleton in a bigger picture eventually.

Done to the last point, I just want to confirm that it's impossible to change spine skeleton size simply by changing the target height and target ortho size in the collector. Since the spine author claims that it works for him but not me, and i have tried this on 2 computers and can't get the scaling working, if it doesn't work for you either then this is probably a spine related issue and I have more proofs here.