2020-04-18 21:32:32 +02:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
[ExecuteAlways]
|
|
|
|
|
public class TerrainModelPlacer : MonoBehaviour {
|
|
|
|
|
private void Update() {
|
2020-04-20 02:38:37 +02:00
|
|
|
|
if (!Application.isPlaying) {
|
2020-04-18 21:32:32 +02:00
|
|
|
|
// Update is called in editor when values change
|
|
|
|
|
Terrain Terrain = GameObject.FindObjectOfType<Terrain>();
|
|
|
|
|
Vector3 Pos = transform.position;
|
|
|
|
|
Pos.y = Terrain.transform.position.y + Terrain.SampleHeight(Pos);
|
|
|
|
|
transform.position = Pos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|