UV tiling with already made coordinates.

Hi. I am making FBX parser in runtime and faced again the problem. FBX has information about vertices coordinates, IDs of those vertices how to make polygons (PolygonVertexIndex), UV coordinates, and UV indexes. Here is what you need: link text. The problem is that when I try to assign UV coordinates to mesh it says that UVs array MUST be the same as vertex array.

The problem is that mesh has 8 vertices (in the example), but Unwrapped UV has 14 vertices. One vertex on a mesh can have more than one UV coordinate vertex.

mesh.SetUVs() gives out of bounds error because vertex array is smaller than UV array.

I tried to use mesh.GetUVs() from the same object that was imported in Editor and it showed me 24 UV coordinates on the cube. While it has only 8 vertexes.

Any ideas how to put UV’s with more vertices on an object while importing FBX?

Hi!
The mesh you’re importing has 8 vertex coordinates, not 8 unique vertices. A unique vertex would be a set of position, uv and normal corresponding to the same vertex. You can get those depending on type of data (the linked file contains “Direct” and “IndexToDirect”). Direct means that the data is (nearly) ready, IndexToDirect means that it contains some data and indices into that data that map it to final layout. The amount of vertices in the first case is given by the number of entries in the array, and by the number of indices in the second case.
To build the final triangles you need the data from PolygonVertexIndex, which gives you the indices of vertex coordinates, the data from normals and the data from UVIndex, which gives you the indices of UV coordinates.