void HeightMap() { showHeightMap = EditorGUILayout.Foldout(showHeightMap, "HeightMap"); if (showHeightMap) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); int size = (int)(EditorGUIUtility.currentViewWidth - 100f); GUILayout.Label(hmTexture, GUILayout.Width(size), GUILayout.Height(size)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (GUILayout.Button("Refresh")) { terrain.LoadHeightMap(hmTexture); } } }