- Home /
Question by
triangle4studios · Mar 21, 2021 at 08:55 PM ·
editortexturesbuttons
Get rid of custom editor button texture cell padding
I am working with GUILayouts in the editor and creating a custom button that uses a texture. However I have no idea how to get rid of cell padding on the button.
void OnEnable()
{
this.selected = (Texture)AssetDatabase.LoadAssetAtPath("Assets/EDITOR/Textures/ButtonActive.png", typeof(Texture));
this.unselected = (Texture)AssetDatabase.LoadAssetAtPath("Assets/EDITOR/Textures/ButtonInactive.png", typeof(Texture));
this.button1 = new GUIContent(unselected);
}
public override void OnInspectorGUI()
{
Config editor = (Config)target;
var button = GUILayout.Button(button1, GUILayout.Width(buttonSize), GUILayout.Height(buttonSize));
if (button)
{
if(button1Status)
{
button1Status = false;
this.button1 = new GUIContent(unselected);
}
else
{
button1Status = true;
this.button1 = new GUIContent(selected);
}
}
DrawDefaultInspector ();
}
Any help would be appreciated.
Comment
Your answer
Follow this Question
Related Questions
Unity Tabs is Empty or Broken someTimes 0 Answers
Building an app/executable is permanently affecting the skybox quality in the editor. Why? 0 Answers
Import textures as truecolor rather than compressed by default 1 Answer
Unity corrupted; textures missing on run, letters missing in editor. 1 Answer