Ниже я поместил код для единственного скрипта в этом проекте, генерирующего карту шума. , а также скриншот результата в режиме воспроизведения в редакторе.
Я ценю время, которое каждый тратит на это.
Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Noise : MonoBehaviour
{
Color[] colorMap;
Texture2D texture;
public Transform[] chunks;
public int dimension = 16;
public float scale = 5;
private void Start()
{
foreach (var chunk in chunks)
{
Renderer rend = chunk.GetComponent();
texture = new Texture2D(dimension, dimension);
texture.wrapMode = TextureWrapMode.Clamp;
texture.filterMode = FilterMode.Point;
colorMap = new Color[dimension * dimension];
rend.material.mainTexture = texture;
SetPixels(new Vector2(chunk.position.x, chunk.position.z));
}
}
public void SetPixels(Vector2 offset)
{
for (int x = 0; x < dimension; x++)
{
for (int y = 0; y < dimension; y++)
{
float xCoord = (x + offset.x) / scale;
float yCoord = (y + offset.y) / scale;
float sample = Mathf.PerlinNoise(xCoord, yCoord);
colorMap[y * dimension + x] = new Color(sample, sample, sample);
}
}
texture.SetPixels(colorMap);
texture.Apply();
}
}

Подробнее здесь: https://stackoverflow.com/questions/793 ... thin-unity