HearthSim / UnityPack

Python deserialization library for Unity3D Asset format
https://hearthsim.info/
MIT License
720 stars 153 forks source link

Not work. Help me #43

Closed NunzioArdi closed 7 years ago

NunzioArdi commented 7 years ago
import unitypack

with open("sounds11.unity3d", "rb") as f:
    bundle = unitypack.load(f)

    for asset in bundle.assets:
        print("%s: %s:: %i objects" % (bundle, asset, len(asset.objects)))
for id, object in asset.objects.items():
    # Let's say we only want TextAsset objects
    if object.type == "TextAsset":
        # We avoid reading the data, unless it's a TextAsset
        data = object.read()
        # The resulting `data` is a unitypack.engine.TextAsset instance
        print("Asset name:", data.name)
        print("Contents:", repr(data.script))

.

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 
=========== RESTART: C:\Users\Administrateur\Desktop\unitypack.py ===========
Traceback (most recent call last):
  File "C:\Users\Administrateur\Desktop\unitypack.py", line 1, in <module>
    import unitypack
  File "C:\Users\Administrateur\Desktop\unitypack.py", line 4, in <module>
    bundle = unitypack.load(f)
AttributeError: module 'unitypack' has no attribute 'load'
>>>