How to save procedurally generated model as asset?

How do you go about saving a procedurally generated model as a project Asset?
I managed to use this code to create the model and save it.

private void CreateModel()
{
    var model = Content.CreateVirtualAsset<Model>();
    model.SetupLODs(new[] { 1 });
    UpdateMesh(model.LODs[0].Meshes[0]);
    Editor.SaveJsonAsset(Globals.ProjectContentFolder + "/model.flax", model);
}

But clicking on the model asset shows an infinite load in the editor.

I see there is Editor.CreateAsset(NewAssetType) but the enum for asset type does not include model.

Any thoughts?

You could use model.Save(true, path) to save the generated model to the file.

1 Like

Thank you very much!