Skip to content

Commit a12ebb4

Browse files
committed
fix: Fixed a compile error in unity versions 2020 and before
1 parent dddcd97 commit a12ebb4

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

Assets/LDtkUnity/Editor/Builders/LDtkSortingOrder.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,19 @@ internal sealed class LDtkSortingOrder
1010
{
1111
public int SortingOrderValue { get; private set; } = 0;
1212
private readonly Dictionary<string, int> _layerNameOverrides;
13-
private readonly HashSet<string> _layerNameOccurrences;
13+
private readonly HashSet<string> _layerNameOccurrences = new HashSet<string>();
1414

1515
public LDtkSortingOrder(Dictionary<string, int> layerNameOverrides = null)
1616
{
1717
_layerNameOverrides = layerNameOverrides;
18-
19-
if (layerNameOverrides != null)
20-
{
21-
_layerNameOccurrences = new HashSet<string>(layerNameOverrides.Count);
22-
}
2318
}
2419

2520
public void Next(string layerIdentifier = null)
2621
{
2722
//note: this supports repeated layer occurrences, even if that never happens.
2823

2924
//Jump to the custom order if we get the first occurrence of a layer
30-
if (layerIdentifier != null && _layerNameOccurrences != null && _layerNameOccurrences.Add(layerIdentifier))
25+
if (layerIdentifier != null && _layerNameOccurrences.Add(layerIdentifier))
3126
{
3227
if (_layerNameOverrides != null && _layerNameOverrides.TryGetValue(layerIdentifier, out int order))
3328
{

0 commit comments

Comments
 (0)