• RuntimesUnity
  • Second texture not loaded after replacing exported files

Hi, I encountered an issue with Unity not loading the second texture atlas from exported Spine data.

Initially, my Spine export only had one texture, and everything was working fine in Unity.
Later, I updated the Spine project and exported again — this time it generated two textures.

However, after manually copying the new .json, .atlas.txt, and texture files into the same Unity folder (via File Explorer), Unity still loaded only the first texture. The second one was not shown, and parts using it appeared pink.

When I placed the exported files into a new folder in Unity, both textures were loaded correctly.

Is this expected behavior? Is there a proper way to refresh the atlas data when replacing exported files?

Thanks!

  • Misaki ответили на это сообщение.
    Related Discussions
    ...

    When you replace exported files in Unity, it is important to ensure that Unity properly recognizes and imports the new files. If you manually copy the files into the existing directory, Unity might not automatically refresh the asset database, which can lead to issues like the one you described, where only the first texture is loaded and the second one appears pink. This is because Unity might still be referencing the old asset data.

    To resolve this, you can try the following steps:

    1. After copying the new files, switch back to Unity and force a refresh by right-clicking in the Project window and selecting "Reimport" on the folder containing your assets.
    2. Alternatively, you can delete the old files from the Unity project before copying the new ones. This ensures that Unity does not retain any old references.
    3. As you discovered, placing the files in a new folder can also trigger Unity to import them correctly, as it treats them as new assets.

    These steps should help Unity recognize the updated files and load all textures correctly.

    Vein Are you using SkeletonGraphic to instantiate the skeleton? If so, you need to enable Advanced - Multiple CanvasRenderers. For more details, please refer to the "Important Material Requirements" section of the SkeletonGraphic component in the spine-unity runtime documentation:
    https://esotericsoftware.com/spine-unity-main-components#Important-Material-Requirements

    • Vein ответили на это сообщение.
    • Vein оценил это.

      Misaki
      Thanks for the clarification!
      In my case, I'm using SkeletonMecanim, not SkeletonGraphic.

      • Misaki ответили на это сообщение.

        Vein I see, in that case, manually reimporting as suggested by Spinebot may solve the issue.

        Generally, updating via File Explorer as you tried should work. If that doesn't work, there may be an issue such as the .atlas.txt file not being updated or the correct file not being referenced. If manual reimporting doesn't work either, please open the .atlas.txt file in any text editor and confirm that it contains information about the second texture atlas page.
        If that is correct, make sure that SkeletonDataAsset is referencing the correct atlas file in Unity.

        • Vein ответили на это сообщение.
        • Vein оценил это.

          Misaki
          thank you for your response.

          I tried updating via File Explorer and then right-clicking the folder in the Unity Project window to select "Reimport," but it didn’t update.
          I was hesitant to delete the old files before copying the new ones, as I was worried that some necessary data might be lost.

          Unfortunately, I deleted the data and reimported it into a new folder before I could check the .atlas.txt file.
          However, before deleting, I confirmed that the SkeletonDataAsset's Atlas was not recognizing the second atlas texture.
          I tried manually adding Element1 and assigning the second atlas there, but it still didn’t reflect properly.

          I’ll make sure to check the .atlas.txt file next time the issue occurs.
          Thanks again for your help!

          @Vein There should be no additional steps like Reimport necessary at all after replacing your skeleton assets. While it does not really help, you could delete the old skeleton assets before copying the new ones over, but be sure to only delete the .skel.bytes or .json, .atlas.txt and .png files and not the actually referenced and potentially modified generated Unity assets like Material, SkeletonDataAsset and the like. In general the only reasonable files to delete are additional no longer needed atlas texture page .png files if the number of pages has gone down from e.g. 3 to 2 pages.

          In general, all you need to do is just be sure that the previous existing skeleton asset files are overwritten by the new files, and that no duplicates are made because the file of the same name already exists.

          If the issue reoccurs and can be reproduced, could you please create a minimal Unity project which still shows this issue? You can send it to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. If there is a bug, we would be happy to fix it.

          • Vein ответили на это сообщение.
          • Vein оценил это.
            7 дней спустя

            Harald
            Thank you for the detailed explanation! That makes sense.
            I’ll make sure to only replace the .skel.bytes, .json, .atlas.txt, and .png files, and avoid touching the generated Unity assets like SkeletonDataAsset.

            If the issue happens again, I’ll try to reproduce it in a minimal project and send it over as you suggested. Appreciate your support!

            • Harald ответили на это сообщение.
            • Harald оценил это.

              Vein Glad it helped, thanks for getting back to us!