The first error is on the line:
]code]Terrain.activeTerrain.terrainData terrain;[/code]
The error is: UnityEngine.Terrain.activeTerrain is a property but used like a type.
The other errors i think i can handle. But this error i can’t resolve.
The first error is on the line:
]code]Terrain.activeTerrain.terrainData terrain;[/code]
The error is: UnityEngine.Terrain.activeTerrain is a property but used like a type.
The other errors i think i can handle. But this error i can’t resolve.
This is how it looks like in the method
static void ApplyHeightmap () {
Texture2D heightmap = Selection.activeObject as Texture2D;
if (heightmap == null) {
EditorUtility.DisplayDialog("No texture selected", "Please select a texture.", "Cancel");
return;
}
Undo.RecordObject (Terrain.activeTerrain.terrainData, "Heightmap From Texture");
Terrain.activeTerrain.terrainData terrain;
You can’t do Terrain.activeTerrain.terrainData terrain;
as that is a property of an object and not an object in and on itself. If you want to use it via a shorthand name you could do:
TerrainData terrain = Terrain.activeTerrain.terrainData;