public void Remove(GridPosition gridPosition) { var controller = _ballArray[gridPosition.X, gridPosition.Y]; if (controller != null) { var logMessage = "Removing ball from grid: " + gridPosition.X + ", " + gridPosition.Y + " type:" + controller.BallType; Logging.Instance.Log(LogLevel.Debug, logMessage); _activeBalls.Remove(controller); controller.SetInactiveInGrid(); _ballFactory.Recycle(controller.gameObject); _ballArray[gridPosition.X, gridPosition.Y] = null; } }