void LoadEnvironment() { var doors = FindObjectsOfType <DoorSystem>(); foreach (var runtime in saveGame.doorRuntimes) { DoorSystem foundSystem = null; foreach (var door in doors) { if (door.GetComponent <SaveGameIdSystem>().SaveGameId == runtime.saveGameId) { foundSystem = door; } } if (foundSystem) { foundSystem.OnLoad(saveGame); } } }