Skip to content

Mesh Import #304

Open
Open

Description

@MKapers

import os
import UnityPy

env = UnityPy.load("name.assetbundle")

extract_dir = 'Mesh/name'
os.makedirs(extract_dir, exist_ok=True)

for obj in env.objects:
if obj.type.name == "Mesh":
mesh = obj.read()

    output_path = os.path.join(extract_dir, f"{mesh.name}.obj")
    
    with open(output_path, "wt", newline="") as f:
        f.write(mesh.export())

Activity

  1. K0lb3 commented on Mar 5, 2025

    @K0lb3
    Owner

    There is no easy way to import a mesh yet in UnityPy due to the required complexity.
    The export as OBJ also converts and drops some data which the OBJ format simply doesn't support,
    so there would be the question of what to do with the data that wasn't exported or converted in an non back transformable way.

  2. changed the title [-]This is how to unzip the file to get .obj. If I want to recompress it, how do I write it?[/-] [+]Mesh Import[/+] on Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions