public void Load() { if (m_Tree == null && !string.IsNullOrEmpty(dataPath)) { if (System.IO.File.Exists(dataPath)) { m_Tree = NavMeshOcTree.Load(dataPath); renderMeshs = m_Tree.GenerateRenderMesh(); } else { m_Tree = null; renderMeshs = null; } } else { if (!System.IO.File.Exists(dataPath)) { m_Tree = null; dataPath = null; renderMeshs = null; } } }
public void Save() { if (m_Tree != null && !string.IsNullOrEmpty(dataPath)) { NavMeshOcTree.Save(m_Tree, dataPath); } }
private void Create() { if (Selection.gameObjects == null || Selection.gameObjects.Length == 0) { return; } if (string.IsNullOrEmpty(m_DataPath)) { string savePath = EditorUtility.SaveFilePanel("Save NavMeshPainterData", "", "", "nmptree"); m_DataPath = FileUtil.GetProjectRelativePath(savePath); } if (!string.IsNullOrEmpty(m_DataPath)) { NavMeshOcTree data = NavMeshOcTree.Create(Selection.gameObjects, m_ContainChilds, m_Angle * 0.5f, m_MaxDepth, m_ForceSetDepth); NavMeshOcTree.Save(data, m_DataPath); } if (m_Painter != null) { //m_Painter.data = m_Data; m_Painter.dataPath = m_DataPath; m_Painter.Reload(m_DataPath); m_Painter = null; } m_DataPath = null; Close(); }
public void Reload(string path) { if (!string.IsNullOrEmpty(path)) { dataPath = path; m_Tree = NavMeshOcTree.Load(dataPath); renderMeshs = m_Tree.GenerateRenderMesh(); } else { dataPath = null; m_Tree = null; } }