Check Fix

This commit is contained in:
Syntriax 2022-12-17 22:44:44 +03:00
parent 723e4a54e0
commit a4fd3343b1
1 changed files with 13 additions and 1 deletions

View File

@ -21,7 +21,7 @@ namespace Syntriax.Modules.Trigger
{
int triggerCount = TriggerCount;
if (triggerCount != previousTriggerCount)
if (!IsArrayAndListIdentical(triggerCount))
{
ColliderList.Clear();
for (int i = 0; i < triggerCount; i++)
@ -33,5 +33,17 @@ namespace Syntriax.Modules.Trigger
previousTriggerCount = triggerCount;
return triggerCount > 0;
}
private bool IsArrayAndListIdentical(int triggerCount)
{
if (previousTriggerCount != triggerCount)
return false;
for (int i = 0; i < triggerCount; i++)
if (!ColliderList.Contains(nonAllocResults[i]))
return false;
return true;
}
}
}