Better Foldout in Unity Custom Editor

#unity
#editor-scripting
BennyKok
Cover Image for Better Foldout in Unity Custom Editor

Creating a better foldout with animation for custom editor in Unity.

Unity's default editor folout

This is how the Unity's default foldout looks like with the code below. Imgur

Customised foldout with smooth transition

This is what it looks like in action. Imgur

AnimBool is the secret

Having little transition in the editor makes it a joy look at. Below is how the AnimBool becomes useful when in conjunction with the BeginFadeGroup.

I already have a utility class to make life easier, this is how to use it.

Full source code for the utility class, it is straight from my Rhythm Game* assets!

Alternative

There are many ways to have a better looking editor GUI in your unity project, take a look at Odin*, gives you way better support for reorderable list editing out of the box just by installing, also have tons of PropertyDrawer like [Button] [FoldoutGroup] [InfoBox] etc.

I used Odin* in most of my other projects, e.g. using the [FoldoutGroup] Imgur

Another similar project in the open source world is NaughtyAttributes, which they have some similar PropertyDrawer features that may suffice your needs. Not to mention that it is on the openupm registry, which you can install it easily to the Unity PackageManager with their cli.

Greetings! There are some Unity affiliate links used in this blog post, I will receive commission if you purchase through these links. While clicking these links won't cost you a cent, it means a lot to me personally.