Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to use unitypy export files by the scene hierarchy? #173

Open
Mi0KINM opened this issue Mar 23, 2023 · 0 comments
Open

How to use unitypy export files by the scene hierarchy? #173

Mi0KINM opened this issue Mar 23, 2023 · 0 comments

Comments

@Mi0KINM
Copy link

Mi0KINM commented Mar 23, 2023

like this
image
Because the file name and container path are same.
image
So when I export the spine files with unitypy ,they would be overwritten.Then, I can only get one file.
image
So,could it export files by the scene hierarchy?
Or any other method could make png, atlas, and skel match is ok.
code:

import os
import UnityPy
from PIL import Image
path = os.path.join(os.path.dirname(os.path.abspath('__file__')), "input")
for f in os.listdir(path):
    env = UnityPy.load(os.path.join(path, f))
    for obj in env.objects:
        if obj.type.name == "Texture2D":
            png = obj.read()
            png.image.save(png.name + '.png')
            png.image = png.image.transpose(Image.ROTATE_90)
            png.save()
        if obj.type.name == "TextAsset":
            a = obj.read()
            with open(a.name, "wb") as f:
                f.write(bytes(a.script))

Sample file:https://drive.google.com/file/d/14R9pFOh1UizFxAaV6Sx5Kt65nyPlEruc/view?usp=sharing

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant