IEnumerator UpdateMemoryCoroutine() { var currentChunkIndex = GetIndex(player.position); // primero chequeo donde está el jugador parado CheckEnable(currentChunkIndex); //chequeamos los vecinos for (var passCount = 1; passCount < maxRadius; passCount++) { for (var i = 0; i <= passCount; i++) // el <= es para que chequee las esquinas tambien { var meshesInstantiated = CheckSideMirrored(passCount, i, currentChunkIndex); meshesInstantiated |= CheckSideMirrored(i, passCount, currentChunkIndex); if (meshesInstantiated) // if meshes have been instantiated { yield return(null); // <- devuelve el flow a unity hasta el siguiente update } } } yield return(null); removeQueue.ResetWithCapacity(memoryManager.PoolCount); LoadGarbageChunks(); yield return(null); foreach (var index in removeQueue) { memoryManager.EnsureDeleted(index); } currentRoutine = null; }