From 0293a920efebf9fce00d58a6bb1990ef8ede0811 Mon Sep 17 00:00:00 2001 From: Timo Eberl Date: Thu, 28 Aug 2025 17:41:31 +0200 Subject: [PATCH] comments --- Assets/Scripts/GrassField.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/GrassField.cs b/Assets/Scripts/GrassField.cs index b057a5b..adef5a7 100644 --- a/Assets/Scripts/GrassField.cs +++ b/Assets/Scripts/GrassField.cs @@ -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 }