Changing a GUIStyle for a button from Java Script to C#

I’ve been using Java Script for my game scripts but need to switch to C#. I have a GUI button that I am trying to customize. Here is the code in Java Script:

function OnGUI()
    var buttonStyle= new GUIStyle("Button");
    buttonStyle.fontSize = 20;
    buttonStyle.normal.textColor =;
    buttonStyle.alignment = TextAnchor.UpperCenter;

GUI.Button(new Rect(0,0,100,100),"Button",buttonStyle));

How do I accomplish this in C#?


Change function to void. Then put the function in the class which is automatically generated by Unity as you create the C# file.

private void OnGUI()
GUIStyle buttonStyle = new GUIStyle(; //Keeps the button looking like a button
buttonStyle.fontSize = 30; //changes font size of button

GUI.button(new Rect(0,0,100,100),"",buttonStyle);  //creates button

I figured it out, thanks!