正如您在图片中看到的那样,选择了深蓝色的“ Layout0”。
我也想在自定义编辑器中创建此框,但实际上发现的不是 EditorGUILayout.BeginScrollView 和其他任何东西。
有人可以告诉我这个可选框的关键字吗?
答案 0 :(得分:0)
我不太确定突出显示的工作原理,但是我认为这是如何实现的。
GUILayout.BeginScrollView
GUILayout.BeginVertical(EditorStyles.helpBox)
对于突出显示,创建蓝色纹理并将其分配给GUIStyle,然后将其用于按钮。在Awake上执行此操作,因此您只需执行一次。
Texture2D texture = new Texture2D(1, 1);
for(int x = 0; x < 1; x++)
{
for(int y = 0; y < 1; y++)
{
texture.SetPixel(x, y, Color.blue);
}
}
texture.Apply();
this.selectedStyle = new GUIStyle();
this.selectedStyle.normal.textColor = Color.white;
this.selectedStyle.normal.background = texture;
将按钮更改为标签按钮GUILayout.Button("name", currentSelected ? this.selectedStyle : GUIStyle.label)