Extract a mesh from an FBX file through scripts

Hi,

I have a script which changes the mesh on the mesh filter at runtime, currently I have an array of meshes which are set using a public array and creating a prefab, I need to change this so that this data is not authored via prefabs and instead the mesh extracted n the fly.

The FBX files are in a “Resources” folder so should be accessible at runtime?

I currently have a load of FBX files numbered 0 → N where each file is structures

mesh1.FBX
-mesh1(Mesh)

mesh1.FBX
-mesh2(Mesh)

So it would be very easy to generate a file path to use a Resources.Load and I know the mesh within the FBX file will have the same name as the FBX, however I have not found a way to get at the mesh without instantiating a full game object with components I don’t want or need and since I will potentially do this for 100+ meshes I cant introduce any extra overheads.

You can just use an array of meshes; you don’t need to instantiate prefabs or anything.

public Mesh meshes[];

Just FYI, FBX files themselves are not included in a build–no source files of any kind are ever included. Only the actual mesh data.