hi, I have created a sphere by changing meshes of a cube, and I would like to save it as a prefab using this code :
GameObject Geo; Geo = new GameObject("myWorld"); MeshFilter GeoMesh = Geo.AddComponent<MeshFilter>(); GeoMesh.mesh = local; GeoMesh.sharedMesh = local; Geo.AddComponent<MeshCollider>(); Geo.AddComponent<MeshRenderer>(); PrefabUtility.CreatePrefab("Assets/World/myWorld.prefab", Geo); AssetDatabase.SaveAssets();
I only save the empty game object, without the mesh. I tried different things but I was never able to save the mesh with the game object.