mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-21 23:58:49 -05:00
fix: replaced TryAdd call to support lower .NET versions
This commit is contained in:
parent
e88822e034
commit
9f57fcf332
@ -245,7 +245,11 @@ namespace UnityAtoms.Editor
|
||||
parent.AddChild(dropdownItem);
|
||||
|
||||
// Use Hash instead of id! If 2 AdvancedDropdownItems have the same name, they will generate the same id (stupid, I know). To ensure searching for a unique identifier, we use the hash instead.
|
||||
if (!idTypePairs.TryAdd(dropdownItem.GetHashCode(), type) && type.FullName != idTypePairs[dropdownItem.GetHashCode()].FullName)
|
||||
if(!idTypePairs.TryGetValue(dropdownItem.GetHashCode(), out var preExistingType))
|
||||
{
|
||||
idTypePairs.Add(dropdownItem.GetHashCode(), type);
|
||||
}
|
||||
else if(preExistingType.FullName != type.FullName) // type already exists, but it might be just the type itself (e.g. happens for me when using a ECS project)
|
||||
{
|
||||
Debug.LogError($"Could not add '{type.FullName}' to list, because it had a hash collision with: {idTypePairs[dropdownItem.GetHashCode()].FullName}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user