Trying to export OBJ to specific text dump format for Unity

Hi, complete newb here… looking for help with converting an OBJ to a specific text dump format. Goal is to be able to import edited mesh into a Unity game. There are utils already (Unity Asset Bundle Editor Avelonia and Asset Studio) that can be used for certain functions.

UABEA can take a mesh from the Unity game UNIT file (asset bundle) and export a TXT dump of the mesh. This utility also has the ability to import a TXT of the same format to replace the original mesh file in the UNIT asset bundle. This importable TXT file is the file I am trying to generate. Note that UABEA does not have the ability to export the mesh in a format suitable for editing in a 3D program like Blender, though.

For that, we need Asset Studio, which can export the same mesh from the same UNIT file, but as an editable OBJ. So, ultimately, what I’m trying to do is export the desired mesh from the UNIT file with Asset Studio as an OBJ file, edit the OBJ file in Blender, and then convert the edited OBJ file into a TXT file with the data inside of the format that can be reimported using UABEA.

I have tried using ChatGPT to assist with generating a python script capable of reading the edited OBJ file and outputting the data in the desired TXT format, but I haven’t had much luck so far. I would be very grateful for any assistance provided!

I’m not sure of the format of the UABEA txt file, but an OBJ is just a plain-text file already.

Here is a link to the specification.

An OBJ is just a list of:

  • vertex locations
  • vertex normals
  • vertex textures (aka UVs)
  • faces (aka which vertices get connected together)

You can open one in a text editor to check it out, then it’s just a matter of formatting that data to match the UABEA specification, which you can do just by opening the file in a text editor, if there isn’t a page that lists the options.

This will primarily be a file-reading and string-formatting challenge, but there are lots of guides for reading and writing text files with Python.