Is there a way to adjust the padding on a button inline, or is the only way through modifying the value via the GUIStyle properties panel?
If it is possible (like GUIStyle.Width(40)), how would I change the padding?
Thanks!
Is there a way to adjust the padding on a button inline, or is the only way through modifying the value via the GUIStyle properties panel?
If it is possible (like GUIStyle.Width(40)), how would I change the padding?
Thanks!
This doesn’t exactly answer my question, but for those of you who come across this question looking for an answer, I was able to pad my button title by placing a " " (or tab) as a string in front of my button title to indent it.
Example:
var ButtonName:String = "";
ButtonName += " ";
ButtonName += "My Button Title";
GUILayout.Button(ButtonName, "myStyle");
Hope this helps someone!
I know the question is old, but since I happened upon it while looking for the answer to the exact same question myself - here is how I did this through code
private GUIStyle buttonStyle = new GUIStyle();
void DefineStyles(){
buttonStyle = GUI.skin.button;
buttonStyle.normal.textColor = Color.white;
buttonStyle.fontStyle = FontStyle.Bold;
buttonStyle.padding.top = -4;
buttonStyle.padding.left = 3;
}//end define Styles
if(GUI.Button(new Rect(145,190,110,15), "Increment All", buttonStyle)){...etc}
Unfortunately, this is somehow changing my button padding on my gui.skin rather than on my buttonStyle GUIStyle like I was expecting it would. Will post the solution to that smaller problem when (if!) I figure it out (I am cheating my way through this right now).
However, I think this is what you were looking for.