Looking at the documentation for the [Terrain][1], I can see that there is a variable called terrainData that stores all of the information regarding heightmaps, which I want to access. However, when calling it from a script, I get the error that states that Terrain does not contain a definition for terrainData. Specifically:
Assets/GameAssets/Scripts/TerrainDeformer.cs(48,24): error CS1061: Type 'Terrain' does not contain a definition for 'terrainData' and no extension method 'terrainData' of type 'Terrain' could be found (are you missing a using directive or an assembly reference?)
Why am unable to access this variable? Here’s some simple example code where it doesn’t work:
using UnityEngine;
using System.Collections;
public class Terrain : MonoBehaviour
{
void Start ()
{
Terrain t = new Terrain();
print(t.terrainData);
}
}
Thank you!
[1]: Unity - Scripting API: Terrain