Skip to content

Instantly share code, notes, and snippets.

@AldeRoberge
Created September 9, 2021 00:58
Show Gist options
  • Save AldeRoberge/e94f786a3e84ce74d79c95cfd19ac4c8 to your computer and use it in GitHub Desktop.
Save AldeRoberge/e94f786a3e84ce74d79c95cfd19ac4c8 to your computer and use it in GitHub Desktop.
Resets an Unity tilemap
using UnityEngine;
namespace Scripts
{
public class MapReset : MonoBehaviour
{
public Terrain terrain;
private float[,] originalHeights;
private void OnApplicationQuit() {
this.terrain.terrainData.SetHeights(0, 0, this.originalHeights);
}
private void Start()
{
this.originalHeights = this.terrain.terrainData.GetHeights(
0, 0, this.terrain.terrainData.heightmapResolution, this.terrain.terrainData.heightmapResolution);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment