K0lb3 / UnityPy

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

Renderer data node mismatch #171

Closed WolfgangKurz closed 1 year ago

WolfgangKurz commented 1 year ago

Need version check and should update classes/Renderer.py file. (from 84 line)

# classes/Renderer.py
# ...

if version >= (4, 3):  # 4.3 and up
    if version[:2] == (4, 3): # 4.3
        self.m_SortingLayer = reader.read_short()
    else:
        self.m_SortingLayerID = reader.read_u_int()

    if version[:2] > (2017, 4):  # Need version check!
        self.m_SortingLayer = reader.read_short()

    # SInt16 m_SortingLayer 5.6 and up
    self.m_SortingOrder = reader.read_short()
    reader.align_stream()

# ...

image See bottom of image. m_SortingLayer and m_SortingLayerID both exists.

My earliest file version is "2017.4.39f1", and it contains that node.

I'm using that code right now to use SortingOrder correctly, please check and fix it!

K0lb3 commented 1 year ago

Thanks for mentioning the issue, I will fix it in some time (among probably some other version related issues for other object classes).