campfire/Assets/Scripts/TerrainModelPlacer.cs
2020-04-20 03:38:40 +03:00

17 lines
526 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
public class TerrainModelPlacer : MonoBehaviour {
private void Update() {
if (!Application.isPlaying) {
// 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;
}
}
}