Skip to content

A simple editor extension to enable unityevent reordering (draggable) feature

Notifications You must be signed in to change notification settings

vlab22/unityevent-reordering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

unityevent-reordering

A simple editor extension to enable unityevent reordering (draggable) feature. I don't know why it is not a default setting.

Tested with Unity 2020.3.5f1

Just put the code inside an Editor folder

using UnityEditor;
using UnityEditorInternal;
using UnityEngine.Events;

[CustomPropertyDrawer(typeof(UnityEventBase), true)]
public class ReorderingUnityEventDrawer : UnityEventDrawer
{
    protected override void SetupReorderableList(ReorderableList list)
    {
        base.SetupReorderableList(list);

        list.draggable = true;
    }
}

Warning

Don't rely on the execution order of the events, use it only for "organization" purposes.
In your project, the execution order will probably work, but when you or a teammate import/reimport your project, the results could be different.
The list will be orderer but the execution could not.

I'll not explain here but you can search for UnityEvents C# delegates order and get good explanations.

About

A simple editor extension to enable unityevent reordering (draggable) feature

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages