From 47ae27ec726b9bf8129041cbf29760ad02a2ec95 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Sun, 27 Aug 2023 01:13:41 +0100 Subject: [PATCH] Add info about reloading terrain while the game is running --- addons/zylann.hterrain/doc/docs/index.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/zylann.hterrain/doc/docs/index.md b/addons/zylann.hterrain/doc/docs/index.md index d1369bf..e800e38 100644 --- a/addons/zylann.hterrain/doc/docs/index.md +++ b/addons/zylann.hterrain/doc/docs/index.md @@ -1007,6 +1007,26 @@ func _ready(): ``` +### Reload while the game is running + +If your want to reload a terrain without restarting the game, you can do the following with a script: + +```gdscript +# Reload terrain data from files, disregarding cached resources +terrain.data.reload() + +# Update the collider, as it won't update automatically +terrain.update_collider() +``` + +So the following workflow is possible: + +- While the game runs, do some changes to the terrain in the editor +- Save the scene containing the terrain +- Optional: tab in/out of Godot to make sure terrain textures get re-imported (if you don't do it, only the heightmap will update and shading might look wrong in changed areas) +- Press a hotkey in the game calling the code that reloads the terrain. + + Export ----------