Problem with EditorGUILayout.ObjectField (496675)

Somewhere in my script before hand it works fine, but when trying to use GUIStyle it doesnt.

c.base_box_style = EditorGUILayout.ObjectField(
								"Base Style: ",c.base_box_style,
								typeof(GUIStyle)) as GUIStyle;

Returns:

Assets/Editor/Conversation_Editor.cs(145,60): error CS1502: The best overloaded method match for `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' has some invalid arguments
Assets/Editor/Conversation_Editor.cs(145,60): error CS1503: Argument `#2' cannot convert `UnityEngine.GUIStyle' expression to type `UnityEngine.Object'

Is this because it doesn’t inherit from ScritableObject? How can I accomplish the same thing?

Well, as the error says, you are not supplying the call with the correct parameters/arguments(and no this is not because you didn’t derive from ScriptableObject), in your case above it expects:

string,
UnityEngine.Object,
a Type,
Any number of UnityEngine.GUILayoutOptions as an array

You gave it(assumptions for your types i can see)
string(good),
c.base_box_style(i have no idea what type this is),
and typeof(GUIStyle)) as GUIStyle.

So whatever type c.base_box_style is, it is not able to be cast to GUIStyle, i mean you are setting that variable and using it within that method call at the same time, what type is c.base_box_style? When is it first instantiated?

public GUIStyle base_box_style = new GUIStyle();

Its a GUIStyle. That is why I am confused about it not being able to cast. Its a public variable in the class that this class is Editor for.

Also right here: UnityEngine.GUIStyle' expression to type UnityEngine.Object’
It says it cant convert c.base_box_style to the type Object. Why would it try to?

It was definitely because it isn’t an “Object”.
I redid my code to accept GUISkin instead.