Beispiel #1
0
        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();
        }
Beispiel #2
0
 private void RebuildData(DefaultAsset asset)
 {
     if (asset != null)
     {
         string path = AssetDatabase.GetAssetPath(asset);
         if (!string.IsNullOrEmpty(path))
         {
             System.IO.FileInfo file = new System.IO.FileInfo(path);
             if (file.Extension.ToLower() == ".nmptree" && file.Exists)
             {
                 m_Target.Reload(path);
                 return;
             }
         }
     }
     m_Target.Reload(null);
 }