Matthew Miner

Methodic: Run Functions by Clicking a Button

Ages ago I built a small Unity editor extension that makes its way into every project I fire up. In a nutshell, it allows you to run functions in a game object’s components through a GUI. I recognize how excruciatingly dull that sentence is, so let me convince you that this is something you need with an example.

Suppose you’re developing a Breakout clone. Each brick gets a component with an Explode function that, well, makes it explode.

using UnityEngine;

class Brick : MonoBehaviour
{
    void Explode ()
    {
        // TODO: add impressive fireball
        Debug.Log("Exploding!");
        Destroy(gameObject);
    }
}

Nice job. Now let’s test your handiwork. There are plenty of ways to run the function, but Methodic provides the easiest. Click the brick game object, open Window > Methodic, hit “Invoke”, and voila: your brick detonates in a fiery blast.

Methodic Window

No extra code necessary. Even groovier, if your function takes arguments, you can specify these using familiar checkboxes and text fields and colour pickers.

Methodic Window With Arguments

Public, private, static, or instance function, Methodic runs them all. You can even execute functions while Unity’s in edit mode.[1] Still yawning? Perhaps a video sells it better.

If this looks like something your game development environment pines for (or if you simply want to make me a wealthy man), you can purchase Methodic for $10 on the Unity Asset Store. I can’t promise that you’ll make better games with it, but you might, and is that an opportunity you can ignore? Not in this economy.


  1. Unity complains when running functions like Object.Destroy that cannot be called in edit mode. This makes sense though — destructive changes are best left for play mode.

Assets for my Breakout clone from Kenney’s Puzzle Pack 2. Thanks Kenney!