using System.Collections; using System.Collections.Generic; using Unity.Burst; using Unity.Collections; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; // Add these struct definitions at the top of the file, outside the class [BurstCompile] public struct GenerateGroundJob : IJobParallelFor { public int chunkStartX; public int chunkStartY; public int chunkSize; public int maxWidth; public int groundDepth; public float scale; public float offsetX; public float offsetY; [WriteOnly] public NativeArray groundTiles; [ReadOnly] public NativeArray perlinNoiseCache; public void Execute(int index) { int x = chunkStartX + (index % chunkSize); int y = chunkStartY - (index / chunkSize); if (x < 1 || x >= maxWidth || y < -groundDepth || y >= 0) { groundTiles[index] = false; return; } groundTiles[index] = perlinNoiseCache[x * groundDepth + Mathf.Abs(y)] <= 0.7f; } }