我创建了一个统一编辑器类,我想在其中选择我的“图块”并添加“墙”。它适用于单选,但我无法解决多选。我发现
[可以编辑多个对象]
但仅此无济于事。这是编辑器脚本:
#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