@@ -19,8 +19,8 @@ namespace UnityGameFramework.Runtime
1919 public class DefaultSettingHelper : SettingHelperBase
2020 {
2121 private const string SettingFileName = "GameFrameworkSetting.dat" ;
22- private readonly string SettingFilePath = Utility . Path . GetRegularPath ( Path . Combine ( Application . persistentDataPath , SettingFileName ) ) ;
2322
23+ private string m_SettingFilePath = null ;
2424 protected DefaultSetting m_Settings = null ;
2525 protected DefaultSettingSerializer m_Serializer = null ;
2626
@@ -43,12 +43,12 @@ public override bool Load()
4343 {
4444 try
4545 {
46- if ( ! File . Exists ( SettingFilePath ) )
46+ if ( ! File . Exists ( m_SettingFilePath ) )
4747 {
4848 return true ;
4949 }
5050
51- using ( FileStream fileStream = new FileStream ( SettingFilePath , FileMode . Open , FileAccess . Read ) )
51+ using ( FileStream fileStream = new FileStream ( m_SettingFilePath , FileMode . Open , FileAccess . Read ) )
5252 {
5353 m_Serializer . Deserialize ( fileStream ) ;
5454 return true ;
@@ -69,7 +69,7 @@ public override bool Save()
6969 {
7070 try
7171 {
72- using ( FileStream fileStream = new FileStream ( SettingFilePath , FileMode . Create , FileAccess . Write ) )
72+ using ( FileStream fileStream = new FileStream ( m_SettingFilePath , FileMode . Create , FileAccess . Write ) )
7373 {
7474 return m_Serializer . Serialize ( fileStream , m_Settings ) ;
7575 }
@@ -332,6 +332,7 @@ public override void SetObject(string settingName, object obj)
332332
333333 private void Awake ( )
334334 {
335+ m_SettingFilePath = Utility . Path . GetRegularPath ( Path . Combine ( Application . persistentDataPath , SettingFileName ) ) ;
335336 m_Settings = new DefaultSetting ( ) ;
336337 m_Serializer = new DefaultSettingSerializer ( ) ;
337338 m_Serializer . RegisterSerializeCallback ( 0 , SerializeDefaultSettingCallback ) ;
0 commit comments