Creating new prefab at runtime

Hi, my company is developing a viewer that will download meshes from the Interwebs at runtime and populate a scene using multiple instances of those meshes. It seems to me the process flow would be something along the lines of:

  1. Download mesh information
  2. Create new Prefab object
  3. Parse downloaded mesh information and build a Mesh object and assign it to the newly created Prefab
  4. Instantiate multiple copies of the prefab and move them around the scene.

Now we've managed to do steps 1, 3, and 4. But for step 2, we're using a prefab we've previously created in the Unity editor (it's just an empty box) at compile time. Our application won't know the number of custom prefabs that will be loaded, so I don't think it makes sense to create a finite number of prefabs in the editor at compile time. Is it possible to create a new Prefab from scratch from C# scripts? I've looked around but all the resources I've found are regarding creating Prefabs in the editor at compile time. Thanks for your time and help!

You wouldn't be creating prefabs, you can just create new gameobjects and add the necessary components to them

example in c#:

GameObject go = new GameObject("Bob");
MeshFilter filter = go.AddComponent<MeshFilter>();
MeshRenderer renderer = go.AddComponent<MeshRenderer>();
filter.mesh = yourMesh;

You can then Instantiate that object over and over if you like, as if it were a prefab