File tree Expand file tree Collapse file tree
Basis/Packages/com.basis.framework/Players/Common Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System ;
12using System . Collections . Concurrent ;
23using System . IO ;
34using System . Threading ;
@@ -54,10 +55,20 @@ public static async Task<BasisPlayerSettingsData> RequestPlayerSettings(string u
5455 else
5556 {
5657 var json = await File . ReadAllTextAsync ( path ) ;
57- data = JsonUtility . FromJson < BasisPlayerSettingsData > ( json ) ;
5858
59- // Version==0 after deserialize signals a zero-initialised struct —
60- // either the JSON was empty/corrupt or predates the Version field.
59+ data = default ;
60+ if ( ! string . IsNullOrWhiteSpace ( json ) )
61+ {
62+ try
63+ {
64+ data = JsonUtility . FromJson < BasisPlayerSettingsData > ( json ) ;
65+ }
66+ catch ( Exception e )
67+ {
68+ BasisDebug . LogWarning ( $ "Player settings at { path } were unreadable ({ e . Message } ); resetting to defaults.") ;
69+ }
70+ }
71+
6172 if ( data . Version == 0 )
6273 {
6374 data = CreateDefaults ( uuid ) ;
You can’t perform that action at this time.
0 commit comments