FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Create context menu in Scene viewElgirhath
    I created some MenuItemfunctions for navigating, which are currently displayed on the menu toolbar. The C# code: using UnityEditor; using UnityEngine; public class Menu : MonoBehaviour { static void rotateView(Quaternion rotation) { SceneView.lastActiveSceneView.LookAt(SceneView.lastActiveSceneView.pivot, rotation); SceneView.lastActiveSceneView.Repaint(); } [MenuItem("View/Front _1")] // FRONT static void FrontView() { rotateView(Quaternion.Euler(0, 180, 0)); } [MenuItem("View
     

Create context menu in Scene view

I created some MenuItemfunctions for navigating, which are currently displayed on the menu toolbar. The C# code:

using UnityEditor;
using UnityEngine;

public class Menu : MonoBehaviour {

static void rotateView(Quaternion rotation) {
    SceneView.lastActiveSceneView.LookAt(SceneView.lastActiveSceneView.pivot, rotation);

    SceneView.lastActiveSceneView.Repaint();
}

[MenuItem("View/Front _1")] // FRONT
static void FrontView() {
    rotateView(Quaternion.Euler(0, 180, 0));
}

[MenuItem("View/Back &1")] // BACK
static void BackView() {
    rotateView(Quaternion.Euler(0, 0, 0));
}

// Few more similar functions

}

I came from Blender, where there are shortcuts opening a context menu on the cursor position like this one, opened after pressing U:

Blender context menu

What I want to do is displaying a context menu after pressing P which would display a list of implemented MenuItems. Is something like this possible in Unity?

❌
❌