Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/scene-view-pie-menu.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **Scene View Pie Menu** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/scene-view-pie-menu.git
```

[![pkglnk](https://www.pkglnk.dev/badge/scene-view-pie-menu.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/scene-view-pie-menu)

README

Scene View Pie Menu

This small unity package makes it easy to create pie menus in the scene view to trigger custom actions. The pie menu works similar to the blender pie menu.

Demonstration

Usage

Create a PieMenu object with PieMenuEntrys and trigger its Perform method with a ClutchShortcut (see example).
Overloads of the PieMenuEntry constructor allow setting the icon with a custom texture or by a string value, to use unity build in icons. A non-exhaustive icon list can be found here.

Example

The following example shows how this package can be used to create the pie menu in the demo.

using JonasWischeropp.Unity.EditorTools.SceneView;
using UnityEditor;
using UnityEditor.ShortcutManagement;
using UnityEngine;

public static class DrawModePieMenu {
    static PieMenu overlay = new PieMenu(new PieMenuEntry[]{
        CreateEntry("Shaded", "TreeEditor.Material", DrawCameraMode.Normal),
        CreateEntry("Wireframe", "TreeEditor.Geometry On", DrawCameraMode.Wireframe),
        CreateEntry("Shaded Wireframe", "d_PreMatSphere", DrawCameraMode.TexturedWire),
    });

    [ClutchShortcut("Draw Mode Pie Menu", typeof(SceneView), KeyCode.Z)]
    static void PerformPieMenu(ShortcutArguments arguments) {
        overlay.Perform(arguments);
    }

    static PieMenuEntry CreateEntry(string name, string icon, DrawCameraMode mode) {
        return new PieMenuEntry(name, icon,
            () => SceneView.lastActiveSceneView.cameraMode = SceneView.GetBuiltinCameraMode(mode),
            () => SceneView.lastActiveSceneView.cameraMode == SceneView.GetBuiltinCameraMode(mode)
        );
    }
}

I would recommend to disable Project Settings > Input Manager > Use Physical Keys. Otherwise, triggering a shortcut like KeyCode.Z would for example require pressing Y on a QWERTZ keyboard because of the swapped key locations.

Setup

Installation using the Package Manager:

  1. Click on the + in the Package Manager window
  2. Chose Add package from git URL...
  3. Insert the following URL https://github.com/JonasWischeropp/unity-scene-view-pie-menu.git
    A specific release version can be specified by appending #<version> (e.g. ...e-menu.git#1.1.0).
  4. Press the Add-Button

Comments

No comments yet. Be the first!