Adding game objects to scene from script

Hello Unity Answers, thanks for helping a newbie.
I’ve got a spaceship which I want to make modular so the player can eg change part of the hull, add cannons, show damage etc, so I want to assemble the ship out of a collection of modules. I made a container class to hold the position, mesh, description etc of each, and a static list of these.
Now I need to add a GameObject to the current scene foreach module in the list, with a mesh and texture specified by the module information class. I can’t work out how this works in Unity. I tried Instantiate with no luck. Please help!

Thanks

Matt the Pie

Is module a data model or a prefab? It could look something like (c# - code not tested):

foreach(Module module in modules)
{
    GameObject moduleGo = (GameObject)Instantiate(module); //if module is a gameObject or prefab

 // or another approach if module is a data model

    GameObject moduleGo = new GameObject(); //create the game object

    MeshFilter filter = moduleGo.AddComponent<MeshFilter>(); //add the meshfilter
    filter.mesh = module.mesh; //assign the mesh

    moduleGo.AddComponent<MeshRenderer>(); //and mesh renderer
    moduleGo.renderer.material.mainTexture = module.texture; //assign the texture to the material
}

you have to give variable with the information you want, and then Instantiate the GameObjects with given Transform