public override void OnInspectorGUI() { GroundSurfaceMaster surfaceMaster = FindObjectOfType <GroundSurfaceMaster>(); GroundSurfaceInstance targetScript = (GroundSurfaceInstance)target; GroundSurfaceInstance[] allTargets = new GroundSurfaceInstance[targets.Length]; for (int i = 0; i < targets.Length; i++) { Undo.RecordObject(targets[i], "Ground Surface Change"); allTargets[i] = targets[i] as GroundSurfaceInstance; } string[] surfaceNames = new string[surfaceMaster.surfaceTypes.Length]; for (int i = 0; i < surfaceNames.Length; i++) { surfaceNames[i] = surfaceMaster.surfaceTypes[i].name; } foreach (GroundSurfaceInstance curTarget in allTargets) { curTarget.surfaceType = EditorGUILayout.Popup("Surface Type", curTarget.surfaceType, surfaceNames); } if (GUI.changed) { EditorUtility.SetDirty(targetScript); } }
public override void OnInspectorGUI() { GroundSurfaceMaster surfaceMaster = FindObjectOfType <GroundSurfaceMaster>(); targetScript = (TerrainSurface)target; Undo.RecordObject(targetScript, "Terrain Surface Change"); if (targetScript.GetComponent <Terrain>().terrainData) { terDat = targetScript.GetComponent <Terrain>().terrainData; } EditorGUILayout.LabelField("Textures and Surface Types:", EditorStyles.boldLabel); surfaceNames = new string[surfaceMaster.surfaceTypes.Length]; for (int i = 0; i < surfaceNames.Length; i++) { surfaceNames[i] = surfaceMaster.surfaceTypes[i].name; } if (targetScript.surfaceTypes.Length > 0) { for (int j = 0; j < targetScript.surfaceTypes.Length; j++) { DrawTerrainInfo(terDat, j); } } else { EditorGUI.indentLevel++; EditorGUILayout.LabelField("<No terrain textures found>"); } if (GUI.changed) { EditorUtility.SetDirty(targetScript); } }