Missing inspector styles

I’m trying to do a scrollbar for a textarea in a custom editor inspector script, using the following snippet.

[CustomEditor(typeof(WebRequestManager))]
public class WebRequestManagerInspector : Editor
{
    Vector2 m_scrollData = Vector2.zero;

    public override void OnInspectorGUI()
    {

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Serial Data", string.Empty);
            GUIStyle horizontalStyle = new GUIStyle();
            horizontalStyle.fixedWidth = 400;
            GUIStyle verticalStyle = new GUIStyle();
            verticalStyle.fixedHeight = 400;
            m_scrollData = EditorGUILayout.BeginScrollView(m_scrollData, true, true, horizontalStyle, verticalStyle, new GUIStyle());
            EditorGUILayout.TextArea(WebRequestManager.DebugGameState.m_dataContent, horizontalStyle);
            EditorGUILayout.EndScrollView();

        EditorGUILayout.Separator();
        base.OnInspectorGUI();
    }
}

The result is that I get an error that the default gui skin is missing some custom styles for:

‘thumb’, ‘leftbutton’, ‘rightbutton’, ‘upbutton’, ‘downbutton’, missing in the inspectorGUISkin.

I can add these custom styles to a new skin. But I don’t have any clue about what the images should look like.

With Unity 3 around the corner, could you put these styles into the default skin?

Thanks a ton. A functional scrollbar for a text area in an inspector would be great.

Perhaps I’m misunderstanding what you’re trying to do, but scrollbars appear just fine in the inspector. Change this line:

m_scrollData = EditorGUILayout.BeginScrollView(m_scrollData, true, true, horizontalStyle, verticalStyle, new GUIStyle());

to this:

m_scrollData = EditorGUILayout.BeginScrollView(m_scrollData, true, true);

and you’ll see it appear. If you need to specify the height of the scroll view, add GUILayout.Height(400) as a parameter to the function.

That worked great. Thanks Matt!

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Serial Data", string.Empty);
            m_scrollData = EditorGUILayout.BeginScrollView(m_scrollData, true, true);
            EditorGUILayout.TextArea(WebRequestManager.DebugGameState.m_dataContent, GUILayout.Height(400));
            EditorGUILayout.EndScrollView();