void SaveMeshToFile() { var filter = grid.GetComponent <MeshFilter>(); var mesh = filter.sharedMesh; var path = EditorUtility.SaveFilePanelInProject("Save mesh", grid.name, "asset", "Select the save path"); Debug.LogFormat("path : {0}", path); AssetDatabase.CreateAsset(mesh, path); AssetDatabase.SaveAssets(); }
void OnSceneGUI() { VR360Grid grid = (VR360Grid)target; for (int i = 0; i < grid.positions.Count; i++) { Vector3 pos = grid.positions[i]; Vector3 newPos = Handles.FreeMoveHandle(pos, Quaternion.identity, .03f, new Vector3(.5f, .5f, .5f), Handles.SphereCap); Handles.Label(pos, "Pos" + i); if (pos != newPos) { newPos = findPositiontOnProjectionFromCamera(newPos, grid.OffsetFromSphere); grid.positions[i] = newPos; } } if (grid.GetComponent <MeshFilter>() != null) { CreateGrid(); } if (grid.positions.Count == 4) { Handles.DrawLine(grid.positions[0], grid.positions[1]); Handles.DrawLine(grid.positions[1], grid.positions[2]); Handles.DrawLine(grid.positions[2], grid.positions[3]); Handles.DrawLine(grid.positions[3], grid.positions[0]); for (int i = 0; i < grid.width + 1; i++) { for (int j = 0; j < grid.height + 1; j++) { Handles.DotCap(0, GetPos(i, j), Quaternion.identity, 0.01f); } } } }