- Home /
Question by
Abhibundela · Sep 17, 2020 at 09:46 AM ·
editorunityeditorscriptableobjectdata storage
Some data of scriptable object resets when Unity Editor restarts
I have created the Save System for my game using Scriptable Objects but everytime I quit and restart the Editor some of the contents resets(not everything). using System.Collections; using System.Collections.Generic; using UnityEngine;
[CreateAssetMenu(menuName = "Scriptable Objects/Save System")]
public class SaveScriptableObject : ScriptableObject
{
public bool isSaved = false;
[Header("Player Properties")]
public Vector3 PlayerPosition = Vector3.zero;
public Vector3 PlayerDirection = Vector3.zero;
public float Health = 100;
public float Stamina = 100;
public float Infection = 0;
public float FlashLightBattery = 100;
public float NightvisionBattery = 100;
[Header("Mount Configuration and Starting Items")]
public List<InventoryWeaponMountInfo> _weaponMounts = new List<InventoryWeaponMountInfo>();
public List<InventoryAmmoMountInfo> _ammoMounts = new List<InventoryAmmoMountInfo>();
public List<InventoryBackpackMountInfo> _backpackMounts = new List<InventoryBackpackMountInfo>();
[Header("Audio Recordings")]
public bool _autoPlayOnPickup = true;
public List<InventoryItemAudio> _audioRecordings = new List<InventoryItemAudio>();
[Header("Game States")]
public List<string> _savedGameStateKeys = new List<string>();
public List<string> _savedGameStateValues = new List<string>();
}
Comment