I've created a unity Editor class, where I want to select my "tiles" and add "wall"s to it. It works for single selection, but I can't work it out for multiple selection. I found
[CanEditMultipleObjects]
but that alone won't help. Here's the Editor script:
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(TileMorpherMonoBehaviour))]
[CanEditMultipleObjects]
public class TileMorpher : Editor {
public override void OnInspectorGUI() {
TileControl tileControl = (target as TileMorpherMonoBehaviour).gameObject.GetComponent<TileControl> ();
if (GUILayout.Button("Add wall")) {
tileControl.addWall ();
}
if (GUILayout.Button("Remove wall")) {
tileControl.removeWall ();
}
}
}
#endif