I find unity editor > “Project” tab > file item can be clicked, but I don’t find clickable label in unity editor script doc, so how to make clickable label
I find the solution, I can change button style to make it like label
public class TestLabelLikeButton : EditorWindow
{
[MenuItem("Test/Label Like Button")]
public static void St()
{
var win = GetWindow<TestLabelLikeButton>();
win.Show();
}
private void OnGUI()
{
GUILayout.Button("Btn", GetBtnStyle());
}
GUIStyle GetBtnStyle()
{
var s = new GUIStyle();
var b = s.border;
b.left = 0;
b.top = 0;
b.right = 0;
b.bottom = 0;
return s;
}
}
Are you trying to make a UI button? If so, you first need a canvas. From the top toolbar:
GameObject → UI → Canvas
then you can add a button:
GameObject → UI → Button