I was working on the map generation improvement part and my player can go to the right side of the map and then spawn terrain chunks but not on the left side on the map, it would but only when the player goes up or down at the empty space. How do i fix this issue?
Can you check if the Left markers in your chunks are spelled with the correct capitalisation? And whether your MapController script spells “Left” in the same way as well:
void ChunkChecker()
{
if (!currentChunk)
{
return;
}
Vector3 moveDir = player.transform.position - playerLastPosition;
playerLastPosition = player.transform.position;
string directionName = GetDirectionName(moveDir);
CheckAndSpawnChunk(directionName);
// Check additional adjacent directions for diagonal chunks
if (directionName.Contains("Up"))
{
CheckAndSpawnChunk("Up");
}
if (directionName.Contains("Down"))
{
CheckAndSpawnChunk("Down");
}
if (directionName.Contains("Right"))
{
CheckAndSpawnChunk("Right");
}
if (directionName.Contains("Left"))
{
CheckAndSpawnChunk("Left");
}
}