Unity Quick Tip: Context Menus

Austin Mackrell
2 min readJun 21, 2021

--

I’ve been using unity’s new input system a lot lately and one thing that has been a pain is quickly testing a function. In the old input system I would do something like:

That no longer works if you are using the new input system and you will get a conflict. But instead of going through and setting up a new action just to test a function we are going to take a look at context menus. Even in the old input system I like using this method more.

Just put square brackets above your function, add ContextMenu and pass in a string for what you want the menu to be named. Save and navigate to your inspector. Press the 3 dots in the top right corner of the script and you will now see your function listed as a context menu command. Simply click it and it will execute, even in editor time!

Quick and easy, with a ton of applications. Hope that helps!

--

--

Austin Mackrell

A Honolulu based software developer, that enjoys surfing, spearfishing, and making videogames