Unity Quick Tip: Context Menus

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!

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Web Scraping using python

Taking Time to Talk Time in Ruby… Time

1 year millionaire challenge : day -2 | 30th Dec, 2021

Deployment strategies for configurable NFTs

An example of an NFT token Metadata file.

5 Preferred Programming Languages for Game Development

Introduction to Software Engineering

Oracle Big Data Service

Microservices driven Architecture

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Austin Mackrell

Austin Mackrell

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

More from Medium

OnCollisionEnter Vs. OnTriggerEnter — When to use them?

Switch Statements | C#

Static Libraries in C

All HTML5 Tags with their descriptions/Uses and examples