Skip to content

Commit

Permalink
Fix expression to work with Unity 2020 or lower
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Oct 21, 2024
1 parent 14f5da6 commit e15ac9d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Runtime/Strategies/TwoTieredCounterStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This software is released under the MIT License.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using DeNA.Anjin.Attributes;
using TestHelper.Monkey.ScreenshotFilenameStrategies;
Expand All @@ -24,14 +25,19 @@ internal static void ResetPrefixCounters()
}

/// <inheritdoc/>
[SuppressMessage("ReSharper", "CanSimplifyDictionaryLookupWithTryAdd")]
public TwoTieredCounterStrategy(string filenamePrefix = null, [CallerMemberName] string callerMemberName = null)
: base(filenamePrefix, callerMemberName)
{
var key = base.GetFilenamePrefix();
if (!s_prefixCounters.TryAdd(key, 1))
if (s_prefixCounters.ContainsKey(key))
{
s_prefixCounters[key]++;
}
else
{
s_prefixCounters[key] = 1;
}

_uniqueNumberOfPrefix = s_prefixCounters[key];
_count = 0;
Expand Down

0 comments on commit e15ac9d

Please sign in to comment.