parth16parikh wrote
Yea size of the image in atlas is 263 x 263. So we tried to increase the size of the blue foot image to 263x263. When we did that we get this error "negative source coordinates".
Could you please describe exactly what you did, and where this exception or error occurred? Could you share some screenshots of the Texture and Sprite import settings?
A side note: I noticed that your foot attachment is a MeshAttachment and not a RegionAttachment. MeshAttachments
are more limited in regard to remapping, so a working setup for RegionAttachments
may produce incorrect results on MeshAttachments
. This is mostly due to the Mesh vertex positions, which cannot be expanded or contracted as RegionAttachments
vertices. Mesh vertices need to stay as they are, only uv coords are modified to map the texture differently.
parth16parikh wrote
Actual size of the green foot in the spine software is 231x207. When we export it from spine, then it will show 263x263 in atlas file. That is the reason why blue foot size is 231x207.
It is strange that the output image in the atlas is larger than the input image. Could you please send us your Spine project files, so that we can have a look at it? Could you please also post a screenshot of your Texture Packer Settings used when exporting the atlas from Spine?
parth16parikh wrote
Also one more update, when we added one pixel black line in 231x207 size blue foot image then it worked properly. I dont know where exactly the problems is. Let me know if you have any explanation.
Most likely the problem is that the Sprite Mesh Type
import setting is set to Tight
instead of Full Rect
, which will additionally clamp transparent borders. Unfortunately tight packing is not yet fully supported in spine-unity. Please try setting it to Full Rect
for now.
I have created an issue ticket here to cover Mesh Type
Tight
:
https://github.com/EsotericSoftware/spine-runtimes/issues/1884
Unfortunately it will most likely take some time until we get to implement this issue ticket, due to many higher priority tasks.
Harald wroteI will investigate (most likely tomorrow) whether behaviour of GetRemappedClone() with useOriginalRegionSize set to false should behave differently than it does right now. I will get back to you once I've come up with an answer.
@[محذوف]
The main problem with the Sprite attachment being too small was due to the implicitly used scale not being equal to the original attachment scale, since it uses the Sprite's Pixels per Unit
value (set to the default value of 100, which leads to a scale of 0.01
).
We have just released some improvements regarding the behaviour when useOriginalRegionSize
is set to false:
Changelog.md wroteAttachment.GetRemappedClone(Sprite)
method now provides an additional optional parameter useOriginalRegionScale
. When set to true
, the replaced attachment's scale is used instead of the Sprite's Pixel per Unity
setting, allowing for more consistent scaling. Note: When remapping Sprites, be sure to set the Sprite's Mesh Type
to Full Rect
and not Tight
, otherwise the scale will be wrong.
So calling GetRemappedClone(.., useOriginalRegionScale : true)
should improve the situation for many cases where you want to maintain the replaced attachment's scale instead of using a specific Sprite scale.
New 3.8 and 4.0-beta unitypackages are available for download here as usual:
Spine Unity Download
Note that only has an effect on RegionAttachments
, not on MeshAttachments
. Please let us know if this works for you as well and whether it improves the situation.
Also beware to set all Sprite's Mesh Type
to Full Rect
and not Tight
as described in the changelog, as this causes improper scale when using the head_robot_test
: when the Sprite is set to Full Rect
it maps correctly, when set to Tight
it is incorrectly stretched vertically.