public void OnProtoSerialize(ProtobufSerializer serializer) { QuickLogger.Info($"Saving {_prefabID.Id} Data"); if (!Directory.Exists(SaveDirectory)) { Directory.CreateDirectory(SaveDirectory); } var saveData = new SaveData { HasBreakerTripped = PowerManager.GetHasBreakerTripped(), TurbineRot = new TargetRotation(_targetRotation), Health = HealthManager.GetHealth(), Charge = PowerManager.GetCharge(), DegPerSec = BiomeManager.GetBiomeData(_currentBiome).Speed, Biome = _currentBiome, CurrentSpeed = _currentSpeed, PassedTime = HealthManager.GetPassedTime(), StoredPower = PowerManager.GetStoredPower() }; var output = JsonConvert.SerializeObject(saveData, Formatting.Indented); File.WriteAllText(SaveFile, output); QuickLogger.Info($"Saved {_prefabID.Id} Data"); //TODO Replace this //LoadItems.CleanOldSaveData(); }