Skip to content

Instantly share code, notes, and snippets.

@stephanmg
Created September 18, 2020 07:07
Show Gist options
  • Save stephanmg/d6a6de1fb6a57c6bfd1dd103e5bbe4bd to your computer and use it in GitHub Desktop.
Save stephanmg/d6a6de1fb6a57c6bfd1dd103e5bbe4bd to your computer and use it in GitHub Desktop.
Save mesh as prefab
GameObject cone = GameObject.Find("cone");
Mesh mesh = cone.GetComponent<MeshFilter>().sharedMesh;
AssetDatabase.CreateAsset(msh, assetpath);
PrefabUtility.SaveAsPrefabAsset(mesh, prefabpath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment