- Home /
Question by
david_31 · Aug 18, 2017 at 10:46 AM ·
error messageeditorguilayoutobjectfield
Strange error in EditorGUILayout.ObjectField()
I have a strange errors in EditorGUILayout.ObjectField() Errors are
Cannot convert from GUIContent to Object
Cannot convert from System.Collections.Generic.List<> to System.Type
Cannot convert from System.Type to GUILayoutOption
Cannot convert from bool to GUILayoutOption
I call this function so
road_editor.roads = EditorGUILayout.ObjectField(new GUIContent("Roads", "List of created roads"), road_editor.roads, typeof(List<Road>), true) as List<Road>;
but in the next line I call this function differently and it works fine
road_editor.material = EditorGUILayout.ObjectField(new GUIContent("Material", "The material of the road"), road_editor.material, typeof(Material), true) as Material;
So I don't understand what is difference between these lines. (I'm sorry if I made mistakes in my English)
Comment
Best Answer
Answer by david_31 · Aug 18, 2017 at 11:24 AM
Oh, I understood my problem. List doesn't extend Object.