File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 5
5
using LootLocker . LootLockerEnums ;
6
6
using LootLocker . Requests ;
7
7
using Newtonsoft . Json . Serialization ;
8
+ using UnityEditor ;
8
9
9
10
10
11
// using LootLocker.Admin;
@@ -279,10 +280,31 @@ protected int GetMaxRequestsInSingleBucket()
279
280
return maxRequests ;
280
281
}
281
282
282
- private static readonly RateLimiter _rateLimiter = new RateLimiter ( ) ;
283
- public static RateLimiter Get ( ) { return _rateLimiter ; }
284
- }
283
+ private static RateLimiter _rateLimiter = null ;
284
+
285
+ public static RateLimiter Get ( )
286
+ {
287
+ if ( _rateLimiter == null )
288
+ {
289
+ Reset ( ) ;
290
+ }
291
+ return _rateLimiter ;
292
+ }
293
+
294
+ public static void Reset ( )
295
+ {
296
+ _rateLimiter = new RateLimiter ( ) ;
297
+ }
285
298
299
+ #if UNITY_EDITOR
300
+ [ InitializeOnEnterPlayMode ]
301
+ static void OnEnterPlaymodeInEditor ( EnterPlayModeOptions options )
302
+ {
303
+ LootLockerLogger . GetForLogLevel ( ) ( "Reset RateLimiter due to entering play mode" ) ;
304
+ Reset ( ) ;
305
+ }
306
+ #endif
307
+ }
286
308
#endregion
287
309
288
310
/// <summary>
You can’t perform that action at this time.
0 commit comments