Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UnityPy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.7.22"
__version__ = "1.7.23"

from .environment import Environment

Expand Down
5 changes: 3 additions & 2 deletions UnityPy/export/SpriteHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from PIL import Image, ImageDraw

from .Texture2DConverter import get_image_from_texture2d
from ..enums import ClassIDType
from ..streams import EndianBinaryReader


Expand All @@ -21,7 +22,7 @@ class SpritePackingMode(IntEnum):


def get_image(sprite, texture, alpha_texture) -> Image:
if alpha_texture and getattr(alpha_texture, "type", "") == "Texture2D":
if alpha_texture and getattr(alpha_texture, "type", ClassIDType.UnknownType) == ClassIDType.Texture2D:
cache_id = (texture.path_id, alpha_texture.path_id)
if cache_id not in sprite.assets_file._cache:
original_image = get_image_from_texture2d(texture.read(), False)
Expand All @@ -45,7 +46,7 @@ def get_image_from_sprite(m_Sprite) -> Image:
elif m_Sprite.m_AtlasTags:
# looks like the direct pointer is empty, let's try to find the Atlas via its name
for obj in m_Sprite.assets_file.objects.values():
if obj.type == "SpriteAtlas":
if obj.type == ClassIDType.SpriteAtlas:
atlas = obj.read()
if atlas.name == m_Sprite.m_AtlasTags[0]:
break
Expand Down