/// <summary> /// Fill the level from the Death Sections (called when the player dies or on start() of this manager) /// </summary> public void PlayerDeathSpawnItemsFromINI(bool specific = false, int specificDeathSectionNumber = 0) { ini.Open(DetermineINIPath()); string DeathSection; if (specific) { DeathSection = "Death" + ((specificDeathSectionNumber).ToString()); if (SceneManager.GetActiveScene().name != ini.ReadValue(DeathSection, "Level", "Default")) { return; //return if the current death section level does not match the active scene name } InstantiateInventoryItemsFromDeath(DeathSection); } else { for (int DeathSectionNumber = 0; ini.IsSectionExists("Death" + ((DeathSectionNumber).ToString())); DeathSectionNumber++) //iterate through all death sections { DeathSection = "Death" + ((DeathSectionNumber).ToString()); if (SceneManager.GetActiveScene().name != ini.ReadValue(DeathSection, "Level", "Default")) { continue; //skip iteration if the current death section level does not match the active scene name } InstantiateInventoryItemsFromDeath(DeathSection); } } ini.Close(); //ini.RemoveBlankLines(DetermineINIPath()); }