void Start() { var sceneName = SceneManager.GetActiveScene().name; m_CoordDataSet = SceneCoordDataSet.CreateBySceneName(sceneName); if (m_CoordDataSet == null) { Debug.LogWarning($"没有初始化格子信息,请在编辑器模式下初始化场景的格子信息(Level下的LevelEditor"); } }
public void LoadCoordDataSet() { //if (m_CoordDataSet != null) return; InitSceneSize(); var sceneName = SceneManager.GetActiveScene().name; m_CoordDataSet = SceneCoordDataSet.CreateBySceneName(sceneName); if (m_CoordDataSet == null) { RecreateCoordDataSet(); } Debug.Log($"载入结束:{m_CoordDataSet.GetCount()}个格子中,一共有多少格子有效:{m_CoordDataSet.GetValueSum()}"); if (!Mathf.Approximately(m_SceneLength, m_CoordDataSet.TerrainLength) || !Mathf.Approximately(m_SceneWidth, m_CoordDataSet.TerrainWidth) || !Mathf.Approximately(m_TerrainBounds.min.x, m_CoordDataSet.MinX) || !Mathf.Approximately(m_TerrainBounds.min.z, m_CoordDataSet.MinY)) { Debug.LogError($"载入的格子数据和当前scene的terrain尺寸不匹配,请重新生成格子数据"); } }