This plugin extends the UnityEventDrawer to display runtime calls in the inspector.
Extend the UnityEventDrawer
to display runtime calls in the inspector.
<< Description | Demo | Installation | Usage | Development Note | Change log >>
Button.onClick and Toggle.OnChangeValue etc. are known as UnityEvent.
UnityEvent has two types of callbacks:
This plugin extends UnityEventDrawer to display runtime calls in inspector.
If runtime call is an instance method, its target is also displayed.
This plugin supports all events that inherit UnityEvent<T0> - UnityEvent<T0, T1, T2, T3>
as well as UnityEvent.
Also, when the Persistent call is empty, UnityEvent is displayed compactly in inspector.
public class TestBehavior : MonoBehaviour
{
[System.Serializable] public class TransformUnityEvent : UnityEngine.Events.UnityEvent<Transform>{};
[SerializeField] TransformUnityEvent onYourCustomEvent = new TransformUnityEvent();
void OnEnable()
{
onYourCustomEvent.AddListener(TestTransform);
}
void TestTransform(Transform t)
{
Debug.Log("TestTransform has called : " + t);
}
}
If you like a development style that heavily uses Runtime calls (MVP pattern, etc.), we recommend using this plugin!
Button
and Toggle
EventTrigger
This package is available on OpenUPM.
You can install it via openupm-cli.
openupm add com.coffee.event-drawer-ex
Find the manifest.json file in the Packages folder of your project and add a line to dependencies
field.
"com.coffee.event-drawer-ex": "https://github.com/mob-sakai/UnityEventDrawerEx.git"
To update the package, change suffix #{version}
to the target version.
"com.coffee.event-drawer-ex": "https://github.com/mob-sakai/UnityEventDrawerEx.git#1.0.0",
Or, use UpmGitExtension to install and update the package.
Packages
(It works as an embedded package. For Unity 2018.1 or later)Assets
(Legacy way. For Unity 2017.1 or later)Button.onClick.AddListener (method)
.Issues are very valuable to this project.
Pull requests are, a great way to get your ideas into this repository.
See sandbox/README.md.
This is an open source project that I am developing in my spare time.
If you like it, please support me.
With your support, I can spend more time on development. :)