• RuntimesUnity
  • Regions layout in Atlas packing and adaptation issue

Hi there!
I had a problem learning the sample scene mix and match skins(Mix and Match Equip GetRemappedClone() useOriginalRegionSize).
The sprite of my character's face default to vertical,but it's laid out horizontally in Atlas's regions.
when i change the skin, It's direction seem doesn't match(All face sprite are the same size and default vertical,the Attachments bound the mesh).
I noticed the instructions on atlas packing,I don't understand the rotation of the Regions caused by auto layout.
Is there a way to rotate the regions's sprite in Unity editor or custom layout the regions to paking Altas in Spine?
Thanks for the help!
Regards.

  • Harald님이 이에 답장했습니다.
    Related Discussions
    ...

    RalphYDY when i change the skin, It's direction seem doesn't match(All face sprite are the same size and default vertical,the Attachments bound the mesh).

    Sorry to hear you're having troubles. Could you please show how (in code) you are assigning the Sprite at your skeleton? What does your input Sprite asset look like, is it un-rotated as shown in the left of your screenshot "other Skin Sprite"?

    • RalphYDY님이 이에 답장했습니다.
    • RalphYDY 님이 이 게시물을 좋아합니다..

      Harald Sure, Thanks so much for your help.
      This is the code function for the temporary test

      public static Skin tempSkin = new Skin("temp");
      public static void ReplaceOptionSkin(SkeletonAnimation aim_Ani, int slot_Num, string skin_Name, int skin_Num)
      {
          SkeletonDataAsset skeletonDataAsset = aim_Ani.SkeletonDataAsset;
          var dataAsset = skeletonDataAsset.GetSkeletonData(true);
          var defaultSkin = dataAsset.FindSkin("default");
          Attachment templateAttachment = defaultSkin.GetAttachment(slot_Num, skin_Name);
          var path = string.Format("BodyParts/{0}/{1}", skin_Num, skin_Name);
          Sprite s = Resources.Load<Sprite>(path);
          if (s == null)
          {
              Debug.Log("NoTextures" + skin_Name);
              return;
          }
          Attachment newattach = templateAttachment.GetRemappedClone(s, defaultMats, true);
          tempSkin.SetAttachment(slot_Num, skin_Name, newattach);
          aim_Ani.Skeleton.SetSkin(tempSkin);
          aim_Ani.Skeleton.SetSlotsToSetupPose();
          aim_Ani.AnimationState.Apply(aim_Ani.Skeleton);
      }

      And the input Settings for the Sprite:

      After then I tried to change the size of the package atlas(256×1024 using Spine's own atlas packing),Face is now working properly when replacing sprite,but eyelash is the opposite(Because It's rotated 90 in the region of the atlas like the face's region before).

      So I unchecked the rotation when the atlas was packed ,Everything is correct.
      As beginner in the spine-unity workflow ,Sorry I didn't carefully understand the function of Spine.
      I wonder if this is the cause of the problem?
      Will the replacement sprite rendered in the attachment be affected by the clipping position and rotation of the region area in the packed atlas?
      Is it the same situation when RegionAttachment replace skin?
      I want know packing atlas without setting rotate will takes up a lot of memory to load if I have a lot of Spine animations?

      • Harald님이 이에 답장했습니다.

        RalphYDY I can see nothing obviously wrong with your code (the passed parameters all look correct as well), nor your Sprite asset. There should be no specific pack settings necessary when exporting from Spine. Could you please send us a minimal Unity project which still shows this issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context.

        • RalphYDY님이 이에 답장했습니다.
        • RalphYDY 님이 이 게시물을 좋아합니다..

          @RalphYDY One setting that I noticed just after having written the above reply: Could you please have a try changing Sprite Mode - Mesh Type from Tight to Full Rect at your replacement Sprite's texture import settings?

          • RalphYDY님이 이에 답장했습니다.
          • RalphYDY 님이 이 게시물을 좋아합니다..

            Harald Thank you so much for your patient reply. I'm sorry, Although I also want to understand the reason behind this question. but I can't share any information about our project due to my company policy.
            Anyway, it does seem to be related to the rotation of the attachments' regions in the atlas after the atlas is packaged.
            Do you think this could be related to the Spine version or something else? (We are using version 3.8)

            You can create a new project that shows the problem without using any of your company's images or code.

            • RalphYDY님이 이에 답장했습니다.
            • RalphYDY 님이 이 게시물을 좋아합니다..

              Nate Thank you for your advice and assistance. The project has been sent.

              • Harald님이 이에 답장했습니다.

                RalphYDY Thanks for sending the reproduction project. Please note that we said "you can send it as a zip package" on purpose. You sent it as a unitypackage, which causes more work on our side.

                You are using an outdated old version of the spine-unity runtime, spine-unity-3.8-2020-09-11.
                When importing your assets with the latest spine-unity 3.8 runtime (spine-unity 3.8 2021-11-10), everything already worked as expected. Please when encountering any problems, update your spine-unity runtime first and see if this resolves your issue.

                The latest spine-unity 3.8 runtime is available for download here as usual:
                https://esotericsoftware.com/spine-unity-download#Older-Versions

                • RalphYDY님이 이에 답장했습니다.
                • RalphYDY 님이 이 게시물을 좋아합니다..

                  Harald
                  Thank you very much for the update suggestions you provided!It has resolved the issue.Sorry for any trouble caused by my previous actions.

                  @RalphYDY Glad it helped, thanks for getting back to us! No worries, just mentioning to make things easier in the future. 🙂