void Awake() { try { jsonLevelData = File.ReadAllText(Application.dataPath + "/Resources/Levels/Level2.json"); } catch (Exception e) { Debug.LogError("Error in loading json data, error is " + e.Message); } ParseLevelJSONToClass(); levelPopulator = FindObjectOfType <LevelPopulator>(); StartCoroutine(levelPopulator.PopulateLevel(levelArray, gridXSize, gridYSize)); }
void Awake() { if (TryToPopulateLevel) { try { _jsonLevelData = File.ReadAllText(Application.dataPath + "/Resources/Levels/Level_1.json"); ParseJSONLevelDataToClass(); _levelPopulator = GetComponent <LevelPopulator>(); StartCoroutine(_levelPopulator.PopulateLevel(_levelArray, _gridXSize, _gridYSize)); } catch (Exception e) { Debug.LogError("Error in loading the json level data file: " + e.Message); } } }
private void Awake() { Instance = this; }