You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug
Seems like the Sprite-Texture2D merging is performed in the wrong direction.
Four Sprite in the sample: notes_crtcl, notes_flick, notes_long and notes_normal, all based on the Texture2Dnotes. (let's ignore the rest of the items here)
I'm expecting all four Sprites in the output, but UnityPy only gives me one Sprite named notes.
Also a tiny bug, too lazy for a separate issue: 1.7.3 breaks str(obj.type), now all items are UnknownType.
To Reproduce
a copy of the file that causes the problem live_note_default.zip (unzip it and you should get an asset bundle file)
A lot of sprites in that asset have the identical container path, so extracting the objects only via the container won't do in this case.
Strictly speaking UnityPy doesn't handle the containers correctly. UnityPy handles them as dict (path -> obj), while they are actually a multi-dict, which can have multiple entries with the same key.
Also a tiny bug, too lazy for a separate issue: 1.7.3 breaks str(obj.type), now all items are UnknownType.
Thanks for reporting that issue, I pushed a fix for it just now.
Are there any plans on completing to TODO of fixing the container dictionary for non-unique container paths?
While I understand and can workaround the fact that I cannot access all of the objects via the container, the issue also prevents me from knowing the container path for some of the objects even when the objects are accessed by env.objects:
A simple solution is to just use a dict of list for self.container_ in SerializedFile, self.m_Container in AssetBundle, the type annotation for env, and other places in tools, examples and the readme. e.g. in SerializedFile.py
I can create a PR if there is no WIP on fixing this issue but I do not understand UnityPy fully so there may be other affected places I missed. I know it is very bad to have such a huge break in backwards compatibility but I am just trying to keep this discussion open.
I'm planning on fixing the issue with UnityPy version 2,
as as you've said, it would break all existing scripts that use the container.
I plan to use either a list of namedtuple or a multidict for the container.
I guess that it would be possible to add a temporary alternative to container,
with container falling back to that alternative to avoid breaking compatibility.
Activity
K0lb3 commentedon Apr 17, 2021
A lot of sprites in that asset have the identical container path, so extracting the objects only via the container won't do in this case.
Strictly speaking UnityPy doesn't handle the containers correctly. UnityPy handles them as dict (path -> obj), while they are actually a multi-dict, which can have multiple entries with the same key.
Thanks for reporting that issue, I pushed a fix for it just now.
erikchan002 commentedon Sep 3, 2022
Are there any plans on completing to TODO of fixing the container dictionary for non-unique container paths?
While I understand and can workaround the fact that I cannot access all of the objects via the container, the issue also prevents me from knowing the container path for some of the objects even when the objects are accessed by
env.objects:A simple solution is to just use a dict of list for
self.container_inSerializedFile,self.m_ContainerinAssetBundle, the type annotation forenv, and other places in tools, examples and the readme. e.g. inSerializedFile.pyUnityPy/UnityPy/files/SerializedFile.py
Line 1 in 61b03e3
UnityPy/UnityPy/files/SerializedFile.py
Line 200 in 61b03e3
UnityPy/UnityPy/files/SerializedFile.py
Lines 277 to 286 in 61b03e3
etc.
This however breaks all backwards compatibility for applications currently using containers.
I can create a PR if there is no WIP on fixing this issue but I do not understand UnityPy fully so there may be other affected places I missed. I know it is very bad to have such a huge break in backwards compatibility but I am just trying to keep this discussion open.
K0lb3 commentedon Sep 5, 2022
I'm planning on fixing the issue with UnityPy version 2,
as as you've said, it would break all existing scripts that use the container.
I plan to use either a list of namedtuple or a multidict for the container.
I guess that it would be possible to add a temporary alternative to container,
with container falling back to that alternative to avoid breaking compatibility.