How about having nice arrays and lists in Unity3d by default?

TLDR: CustomEditorBase.cs (github or bitbucket)

I have been using Unity3d for quite some time now and I always found cumbersome working with exposed arrays and lists in the editor. And versions had come and gone a lot has changed and improved but not this particular thing.

Deleting and sorting items being the most elaborate to pull off.


The other day while writing a custom editor I found this particular thing

MS VS C# Intelisense tooltip while writing the CustomEditorAttribute

Indeed, the light bulb was on!

By defining a new CustomEditor for all UnityEngine.Objects and its childs (MonoBehaviour and ScriptableObject) I can replace the default Inspector for any object.

[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor{ …}

While trying to fix the list/array situation I found this article.

So I used ReorderableList for the arrays and lists and it looks and works amazingly.

You can get the full custom editor code at github or bitbucket.

Just drop the file inside an “Editor” folder within your project and it will work for all your MonoBehaviors without needing to specify anything. It just simply works.


Code (left) — Default Unity Inspector (center) — Custom default Inspector (right)