nesrak1/AssetsTools.NET

Grabbing the VertexData of a mesh?

Closed this issue · 1 comments

Hiya! Is it possible to grab the vertice data of a mesh so I can reconstruct the mesh inside of Unity at runtime?

I've got it to where I can grab any of the data of the Mesh object, only problem is that I don't think theres Vector3 support inside of AssetsTools.NET which is needed for Unity's mesh stuff :P

Vector3 fields are just like any other field. Normally you could just say someField["vector3Field"]["x"].GetValue().AsFloat() or whatever. The issue isn't that, rather that meshes store data in an unusual way compared to other assets. It uses a stream of a lot of different bits of data stored in m_VertexData/m_DataSize (essentially a byte array) or it can be stored in resS which the path/offset is found in m_StreamData. In either case, the library just gives you access to the fields, it doesn't have any mesh stream parsing code. You can look around at other projects to see how they do mesh handling.