K0lb3 / UnityPy

UnityPy is python module that makes it possible to extract/unpack and edit Unity assets
MIT License
761 stars 113 forks source link

The container attribute of the file cannot be read correctly #236

Open nijinekoyo opened 1 month ago

nijinekoyo commented 1 month ago

Code

objectType = object.type.name
objectContainer = object.container
if objectType not in exportTypes:
    return

try:
    fileData = object.read()
except Exception as e:
    print(f"Error: {e}")
    return

if hasattr(fileData, "name") == False or fileData.name is None or fileData.name == "":
    return

fileName = fileData.name

if objectType == 'Mesh':
    print(object.container) # print None

Bug The same file can get container information in AssetStudio, but it cannot be obtained normally with UnityPy. Print will get None

image

To Reproduce