【发布时间】:2015-10-12 21:18:58
【问题描述】:
我创建了一个统一的编辑器类,我想在其中选择我的“图块”并向其中添加“墙”。它适用于单选,但我无法解决多选。我找到了
[CanEditMultipleObjects]
但仅此一项并没有帮助。这是编辑器脚本:
#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
【问题讨论】:
标签: unity3d unity3d-gui