This commit is contained in:
Timo Eberl 2025-08-28 17:41:31 +02:00
parent d6c0048271
commit 0293a920ef
Signed by: Timo
SSH Key Fingerprint: SHA256:swVjhbVzKCLQZNtwPqMEmtOUG3FTydzVrpIKpUZYTQw

View File

@ -77,13 +77,16 @@ public class GrassField : MonoBehaviour {
private void Update() {
#if UNITY_EDITOR
// update LOD distances (might have been changed via inspector)
// LOD distances might have been changed via Inspector -> Update materials
// Camera might have been moved -> Update LODs
UpdateLODsAndMaterials();
#else
if (_chunks.Length != numChunks * numChunks) return;
var cam = Camera.main;
if (!cam) return;
UpdateLODs(cam.transform.position, false); // while the game is running, only update the chunks near the camera
// while the game is running, only update the chunks near the camera
// if the camera moved a great distance since the last frame, this fails
UpdateLODs(cam.transform.position, false);
#endif
}