Context Circle Menu is Unity tool that allows users to open a circular menu in the Scene view to quickly execute user-defined methods, enhancing workflow efficiency.
Context Circle Menu is a simple open-source tool for Unity. It lets users open a circular menu in the Scene view or as a standalone VisualElement. This menu makes it easy to quickly use your own methods, helping you work faster by avoiding complex menus. Perfect for developers wanting to manage their scenes better and save time, Context Circle Menu is flexible and easy to use.
- Create Context Circle Menu
-
Easy to use Editor Icon
-
Customized Menu
- Add from Attribute
- Add Manual
-
Open in Scene View
-
Customized Shortcut Key
- Unity 2022.3 or higher
- select Window > Package Manager
- Select the "+" button > Add package from git URL
- Enter the following URL
https://github.com/Garume/ContextCircleMenu.git?path=/Assets/ContextCircleMenu
Or open Packages/manifest.json and add the following to the dependencies block
{
"dependencies": {
"com.garume.context-circle-menu": "https://github.com/Garume/ContextCircleMenu.git?path=/Assets/ContextCircleMenu"
}
}
Just apply the Context Circle Menu
attribute to the static method you wish to add.
public class Menu
{
[ContextCircleMenu("Debug Test")]
public static void TestMethod()
{
Debug.Log("TestMethod");
}
}
Then you will see below menu.
Press the A
key on the scene view.
If you want to create folders, separate them with /
.
public class Menu
{
[ContextCircleMenu("Example/Debug Test")]
public static void TestMethod()
{
Debug.Log("TestMethod");
}
}
Then you will see below menu.
Icons can be attached to menu buttons.
The EditorIcons
class is provided as a utility to add icon easily.
To add an icon, do the below.
[ContextCircleMenu("Debug Test", EditorIcons.ConsoleInfoIcon)]
public static void TestMethod()
{
Debug.Log("TestMethod");
}
If you do not want to use the Context Circle Menu
attribute, you can register the method manually.
The process of registering methods internally can be hooked.
public class Menu
{
[InitializeOnLoadMethod]
private static void Initialize()
{
ContextCircleMenuLoader.OnBuild += (builder =>
{
builder.AddMenu("Debug Test", EditorGUIUtility.IconContent(EditorIcons.ConsoleInfoIcon), () => Debug.Log("Debug Test"));
builder.AddMenu("Instantiate/Cube", EditorGUIUtility.IconContent(EditorIcons.PreMatCube), ()=> GameObject.CreatePrimitive(PrimitiveType.Cube));
builder.AddMenu("Instantiate/Sphere", EditorGUIUtility.IconContent(EditorIcons.PreMatSphere), ()=> GameObject.CreatePrimitive(PrimitiveType.Sphere));
});
}
}
If you don't like the button UI, you can replace it with your own.
Use builder.ConfigureFolder();
Caution
It is an incomplete feature.
Destructive changes may be made.
First, you need to create a FolderMenu that extends CircleMenu
.
You can create buttons freely in CreateButtons
.
Please refer to FolderCircleMenu.cs
for detailed code.
Next, create a FolderMenuFactory that implements IFolderCircleMenuFactory
.
Please refer to CircleMenuFactory
for detailed code.
Finally, you can replace the UI by doing the below.
ContextCircleMenuLoader.OnBuild += (builder =>
{
...
builder.ConfigureFolder(FolderMenuFactory);
});
The default menu open/close button is set to the A
key, but can be changed freely.
Edit > Shortcuts
to open a window.
Search for Context Circle Menu
and you will find the settings as shown in the figure below.
Set the keys as you like.
MIT
@Garume