GUILayout custom styles

How do you apply custom or unity styles to GUILayout?

The help goes into some detail on how to do it just with GUI but doesn’t mention it (or I can’t find it) for GUILayout.

So say I want a GUILayout.Toggle but as a button style, how do you do that?

Hi monark

I think, that is what you’re looking for:

In the middle of the page you can find “Working with Styles”.

Last line of the following code should / could help you.

// Make a button that uses the "toggle" GUIStyle
GUI.Button (Rect (10,140,180,20), "This is a button", "toggle");

Alex

Yeah that’s the bit i know about but that works only with GUI, it’s specifically GUILayout that I’m now wondering about.

Hmm, maybe like this:

GUILayout.Toggle(true, “Text in this button”, “button”);

Here’s the corresponding script reference page:

Hope I can help you with this.

That’s the page I was looking for!

I kept ending up here

and then not clicking through to the individual help where it shows all the different forms for the functions. Doh!