protected void ClearColliders() { var collidersEnumerator = _gameObjectColliders.GetEnumerator(); try { while (collidersEnumerator.MoveNext()) { var colliderList = collidersEnumerator.Current.Value; ColliderListCache.Dispose(colliderList); } } finally { collidersEnumerator.Dispose(); } _gameObjectColliders.Clear(); collidersEnumerator = _rigidBodyColliders.GetEnumerator(); try { while (collidersEnumerator.MoveNext()) { var colliderList = collidersEnumerator.Current.Value; ColliderListCache.Dispose(colliderList); } } finally { collidersEnumerator.Dispose(); } _rigidBodyColliders.Clear(); DetectedColliders.Clear(); ClearLineOfSight(); }
protected virtual void OnEnable() { _rigidBodyColliders.Clear(); _gameObjectColliders.Clear(); _rayCastTargets.Clear(); _objectVisibility.Clear(); _raycastResults.Clear(); _tempGoList.Clear(); DetectedColliders.Clear(); }