Improve Workflow to Maintain Discipline - Unity Menu Items

Photo by Will Porada on Unsplash

Improve Workflow to Maintain Discipline - Unity Menu Items

Extend the Unity Editor to Help with Motivation and Documentation

This is an article moved from my old blog

For those who follow me on Twitter, you’ve probably noticed a lot of #GameDev tweets and this will be a post on improving workflow for creating GIFs quickly of your game. Naturally, the same code can be extended for pretty much anything you want to add, so let’s get started.

Why?

I recently tweeted an interesting article on creating GIFs of your game to help with marketing. However, I also find creating GIFs useful for documentation as well as the ability to be able to look back in the future and be able to see the (hopefully!) improvements and progress the game has made. Additionally, writing a post-mortem of the game would be made easier since you can refer back to the GIFs quickly without having to resort to jumping to past source control commits.

The problem is remembering or bothering to create the GIFs; so creating a good workflow will mean I’m more likely to keep up this practice. Every time I do a visually significant commit to source control, I now create a GIF of the new feature regardless of how primitive it looks.


How?

Adding menus to the Unity editor is simple and the code snippet below adds a Tools menu which contains an option. Clicking this option will open GifCam, which is the GIF recording tool I’m using, but you can modify it to open whatever you use (I’m happy to hear other suggestions for GIF tools).

Simply create a new Script in Unity, remove the default Start and Update methods and replace it with this.

public class MenuItems : MonoBehaviour { 

    [MenuItem("Tools/GifCam")]
    private static void NewMenuOption()
    {
        Process.Start(@"C:\MyPathToGifCamFolder\GifCam.exe");
    }
}

Of course, you’d want to change the path to your tool to match your location. MenuItems is the name of my class but you can change that to whatever you like as well.

The key aspect is the [MenuItem(”Tools/GifCam”)] attribute. Tools is the name of the menu I want to add and GifCam is the name of the menu item. You can add submenus too, for example [MenuItem(“Tools/Gif Tools/GifCam”)]*.*

Compile the code and look at the menu in Unity, you should have your new menu ready to use!

image

Now I’m more likely to be good when it comes to keeping up to date with creating GIFs during development. Of course, this could be extended to all sorts of other tools you might want to use intermittently but without having to keep open at all times. The ultimate idea is to improve your workflow to reduce any friction when it comes to developing your game.

Enjoy :)