Assets/Editor/UpdateTreeColors.js(13,17): BCE0031: Language feature not implemented: UnityEditor.

It’s for the Island Demo on unity, I’d like to get it working but I keep getting these errors and I know some Javascript but all in all I’m rather inexperienced.

Here’s my code.

@MenuItem("Terrain/Update Tree Lightmap Color")
static function RebuildWithLightmap () {
	var tex : Texture2D = Selection.activeObject as Texture2D;
	if (tex)
	{
		if (Terrain.activeTerrain == null || Terrain.activeTerrain.terrainData == null)
		{
			EditorUtility.DisplayDialog("No active terrain in the scene", "No active terrain in the scene", "Ok");
			return;
		}
		
		Undo.RegisterUndo(Terrain.activeTerrain.terrainData, "Set Tree colors");
		UnityEditor.TerrainLightmapper.UpdateTreeLightmapColor(tex, Terrain.activeTerrain.terrainData);
	}
	else
		EditorUtility.DisplayDialog("Select a lightmap", "Select a lightmap", "Ok");
}

@MenuItem("Terrain/Update Tree Color")
static function RebuildWithColor () {
	var tex : Texture2D = Selection.activeObject as Texture2D;
	if (tex)
	{
		if (Terrain.activeTerrain == null || Terrain.activeTerrain.terrainData == null)
		{
			EditorUtility.DisplayDialog("No active terrain in the scene", "No active terrain in the scene", "Ok");
			return;
		}
		
		Undo.RegisterUndo(Terrain.activeTerrain.terrainData, "Set Tree colors");
		UnityEditor.TerrainLightmapper.UpdateTreeColor(tex, Terrain.activeTerrain.terrainData);
	}
	else
		EditorUtility.DisplayDialog("Select a lightmap", "Select a lightmap", "Ok");
}

So if anyone can help that’d be great. It says it’s on this line:

UnityEditor.TerrainLightmapper.UpdateTreeLightmapColor(tex, Terrain.activeTerrain.terrainData);

Thanks!

The answer is that the Island demo is quite old. The TerrainLightmapper class doesn’t exist anymore in the current Unity version. I would say you can just remove this file from your project. Usually all terrain stuff is now built-in. It’s just an editor script, so nothing that influences the demo itself. It’s a tool-extension for the editor.