Method Clicker

This asset allows you to conveniently add a clickable button to any inspector in Unity with just a single line of code, and make it invoke any method you want!


Basic functionality

This asset provides a class McPtr which stands for "Method Click Pointer", and it does exactly what it says - points to a method wich you'll be able to invoke by clicking on a button in editor. It's really a matter of a single line of code:

How it works

Very simple: whenever editor encounters this field - it renders a button with a field name as it's text. And when you click that button - it invokes the next method it encounters in script. That's it!

There are couple of simple rules however that you must follow:

But you're not limited to the next method only - if you add a MethodClicker attribute to it, you can reach any method in that script!

Visual features

Though it requires only one line of code to work, it really has limitless functionality! You can fully adjust it's view if you decide to actually create an instance of this class instead of only defining it:


Render custom GUI

And even more! You can enhance it's possibilities by using ArbitraryGuiCode field of McPtr class. Just assign a function with a custom gui code to that field and it will render that code right after rendeing a button! Note that you need to specify the required height of a property field if you want your custom gui not to overlap with other editor controls.


Features:


Current status: pending review on Asset Store

Please, contact me on any questions, bugs founded or feature requests. I'm always trying to help as quickly as possible and enhance my assets with new functionality.

Gallery