public static void LoadCell(string loadCell) { // Unload existing scenes foreach (var cell in Instance.loadedCells.Values) { SceneManager.UnloadSceneAsync(cell); } if (Instance.InteriorCell.IsValid()) { SceneManager.UnloadSceneAsync(Instance.InteriorCell); } Instance.loadedCells.Clear(); // Change this into an interface or something? if (string.IsNullOrEmpty(loadCell)) { Instance.Start(); Instance.enabled = true; } else { Instance.enabled = false; var cell = CellRecord.GetInteriorCell(loadCell); Instance.InteriorCell = LoadCell(cell); Instance.currentCell = cell; OnFinishedLoadingCells?.Invoke(cell); } }
private void Start() { // Code for loading multiple cells at once coordinates = new Vector2Int(Mathf.FloorToInt(Target.position.x / 8192), Mathf.FloorToInt(Target.position.z / 8192)); loadedCells = LoadCells(); OnFinishedLoadingCells?.Invoke(currentCell); }