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:
- Persistent call
- Runtime call
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!
- Displays runtime calls in inspector
- Expands/collapses the runtime call view
- Displays instance method, its target is also displayed
- When the Persistent call is empty, displays it compactly
- Supports pro skin
- Supports all components as well as uGUI components such as
Button
andToggle
- Supports
EventTrigger
- Unity 5.5 or later
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.
To update the package, change suffix #{version}
to the target version.
- e.g.
"com.coffee.event-drawer-ex": "https://github.com/mob-sakai/UnityEventDrawerEx.git#1.0.0",
Or, use UpmGitExtension to install and update the package.
- Download a source code zip file from Releases page
- Extract it
- Import it into the following directory in your Unity project
Packages
(It works as an embedded package. For Unity 2018.1 or later)Assets
(Legacy way. For Unity 2017.1 or later)
- Add a runtime call, such as
Button.onClick.AddListener (method)
. - Information about the runtime call is displayed in inspector.
- Enjoy!
Issues are very valuable to this project.
- Ideas are a valuable source of contributions others can make
- Problems show where this project is lacking
- With a question you show where contributors can improve the user experience
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. :)
- MIT
- GitHub page : https://github.com/mob-sakai/UnityEventDrawerEx
- Releases : https://github.com/mob-sakai/UnityEventDrawerEx/releases
- Issue tracker : https://github.com/mob-sakai/UnityEventDrawerEx/issues
- Change log : https://github.com/mob-sakai/UnityEventDrawerEx/blob/main/CHANGELOG.md