Skip to content

Commit 4f07bc7

Browse files
committed
chore(Texture2DConverter): only bytes cast image_data if not already bytes
1 parent b643481 commit 4f07bc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

UnityPy/export/Texture2DConverter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ def parse_image_data(
299299
else:
300300
width, height = get_compressed_image_size(width, height, texture_format)
301301

302-
image_data = bytes(image_data)
302+
if not isinstance(image_data, bytes):
303+
# bytes(bytes item) would cause an unnecessary copy
304+
image_data = bytes(image_data)
303305

304306
if "Crunched" in texture_format.name:
305307
if (

0 commit comments

Comments
 (0)