Problem with loading multiple mesh groups with Resource.Load()

This is a Editor script, the problem is; I’m loading and attaching a mesh with Resource.Load():

Mesh mesh = (Mesh)Resources.Load(string.Format(@"{0}", asset.Name.Split('.')[0]), typeof(Mesh));

Though when I attach it (with asset.AddComponent<Mesh>().mesh = mesh, it only grabs one of the Meshes in the group but there are multiple groups:


How would I be able to add all the meshes in this case to my GameObject?

There can typically only be one mesh per GameObject.

What you need to do is call Resources.LoadAll for that file to get all the meshes. Then you need to create a new GameObject for each one, make it a child of the script GameObject, and apply the meshes individually to the newly created GameObjects.