playMaker

Author Topic: Desperate for Searchable Enum Drawer Integration in Playmaker [SOLVED]  (Read 4296 times)

josephthom12

  • Playmaker Newbie
  • *
  • Posts: 10
Hello Playmaker community,

I’m reaching out for help integrating a searchable Enum Drawer into Playmaker, specifically using the Enum Drawer from UnityEditorJunkie. https://github.com/roboryantron/UnityEditorJunkie/tree/master/Assets This feature is sorely needed to address a major limitation in handling large enums within Playmaker. I cant overhaul the Unity editor or the Playmaker API even with Chat GPT. This issue has existed since the dawn of playmaker and Unity and time itself.

Why This Matters:
For those who work with long lists of enum values (e.g., 50–100+ entries), the current selection system in Playmaker is extremely cumbersome, especially on Windows. Here are some major issues:

No Mouse Wheel Scrolling: The enum dropdown in Playmaker lacks mouse wheel support, so we can’t scroll quickly through values.
Lack of a Search Box: There’s no way to search within the enum dropdown. This means that finding specific values requires either navigating slowly or iterating through the list one by one.
Single-Letter Selection Limitation: Typing a letter only brings up entries that start with that letter in succession, meaning I still have to scroll through each one.
Windows-Only Down Arrow Clicking: On Windows, the enum list provides only a down arrow, which requires dozens of clicks to reach lower entries. On Mac, at least, it’s slightly easier due to smoother dropdown scrolling. Can someone at least point me in the right direction. I'm not talking about the inspector enum list. I want to change the crap inside of playmaker. However, it looks like the enmu list is system wide across the Unity Editor.
« Last Edit: November 10, 2024, 12:01:52 PM by josephthom12 »

josephthom12

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Desperate for Searchable Enum Drawer Integration in Playmaker
« Reply #1 on: November 10, 2024, 01:02:16 AM »
For any interested please note.

The issue seems to stem from Unity's use of the OS-native dropdown system (EditorGUI.EnumPopup and similar methods). This is deeply integrated into Unity's IMGUI system, which Playmaker uses. That’s why on a Mac you can use your mouse wheel to scroll through a large list. But on Windows it acts like a standard right click context menu should.

It’s not playmaker itself. The core issue I THINK is the actual enum/event selection dropdowns in Playmaker are still using the limited Windows-style dropdown UI.

The only temporary workaround handicap is to use some sort of Enum Attribute Organization. To catagorize items and use the arrow approach. For example fruit → apple, orange

public enum Item
{
    [InspectorName("Weapon/Melee/Sword")]
    Sword,
    [InspectorName("Weapon/Melee/Axe")]
    Axe,
    [InspectorName("Weapon/Ranged/Bow")]
    Bow,

https://discussions.unity.com/t/manage-lots-of-enum-choices-in-the-inspector/249118/1


Claude AI 3.5 Sonnet and Opus, Phind 405B, ChatGpt4o and Copilot all suggest some sort of Direct Unity Editor Modification (Risky but Effective) Or PlayMaker Source Modification (No Access) or Create a custom Unity package that replaces the default enum dropdown. I have tried with no success. This is where we'd need to dig into Unity's internal API and oh my god I have no idea where to start.

josephthom12

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Desperate for Searchable Enum Drawer Integration in Playmaker
« Reply #2 on: November 10, 2024, 11:54:14 AM »
SOLUTION: Mouse Wheel Scrolling for Unity Context Menus (Windows)

I've created a Python script that enables mouse wheel scrolling in Unity's context menus (including PlayMaker's enum/event selection dropdowns) on Windows. While this isn't a perfect solution to the enum drawer issue, it makes navigating large lists much more manageable.

What the Script Does:
- Enables mouse wheel scrolling in Unity's context menus
- Converts mouse wheel movements into Up/Down key presses
- Only activates when Unity is the active window and a context menu is open
- Works with PlayMaker's enum/event selection dropdowns
Code: [Select]
[url]unity_context_scroll_helper.py[/url]Technical Details:
The script uses pynput to detect mouse wheel events and simulates keyboard input:
- Upward scroll → Up arrow key press
- Downward scroll → Down arrow key press

Requirements:
- Python installed on Windows
- pynput library (install via: pip install pynput)
- win32api (install via: pip install pywin32)


While this isn't a complete solution to the enum drawer limitations, it at least makes navigating large lists more bearable on Windows by adding mouse wheel support. The script is particularly useful when dealing with large enum lists or event selections in PlayMaker.

Usage:
1. Install required Python libraries
2. Save the script and run it before opening Unity
3. Use mouse wheel to scroll through any context menu in Unity

This is a workaround while we wait for proper enum drawer improvements in Unity/PlayMaker. If anyone needs help with how to install python and run it I can maybe provide an auto hotkey version.
RECOMEND: Get a good mouse that can use fast scrolling. The Signature M650 features SmartWheel scrolling that delivers precision or speed. You can blast through the list at the speed of sound.
RANT: Oh unity dev team who can’t satisfy everyone. The post from this thread confirms they are rolling back functionality to keep us in a cave. Why roll with Unity 6 if 5 and below cant get right? $$$ https://discussions.unity.com/t/state-of-the-enhanced-contextual-menu-in-unity-6/1541613
Quote
Since then, priorities shifted, and the feature took a backseat.
Here are a bunch of links that better describe the WINDOWS issue with long context menus and lead to dead ends. This is leg work for someone how can articulate the problem. https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Enable-mouse-wheel-scrolling-in-context-menus/idi-p/3975539 https://discussions.unity.com/t/editors-inspector-dropdown-lists-scroll-very-slowly-with-no-mousewheel/238719 https://discussions.unity.com/t/editorguilayout-enumpopup-and-scrolling/598433/3 https://www.tenforums.com/customization/24404-windows-10-context-menus-have-huge-padding.html https://www.elevenforum.com/t/context-menu-text-size.23077/ https://www.elevenforum.com/t/how-to-reduce-expanded-context-menu-vertical-spacing-padding-and-dupe-entries.25950/

josephthom12

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Desperate for Searchable Enum Drawer Integration in Playmaker [SOLVED]
« Reply #3 on: November 10, 2024, 12:08:39 PM »
Sorry. I forgot to post the Unity Enum Drawer Context Menu Scroll Helper script.  :)
Call it whatever you want. This script:

Uses pynput to specifically listen for scroll events
Properly distinguishes between scroll directions using dy
Only activates when in Unity and a context menu is visible
Handles each scroll direction independently

playmaker_scroll_helper.py

Code: [Select]
from pynput import mouse
import win32api
import win32con
import ctypes
from ctypes import windll
import time

user32 = ctypes.windll.user32

def is_unity_window():
    hwnd = user32.GetForegroundWindow()
    class_name = ctypes.create_unicode_buffer(64)
    user32.GetClassNameW(hwnd, class_name, 64)
    return class_name.value == "UnityContainerWndClass"

def is_context_menu_visible():
    menu_hwnd = user32.FindWindowW("#32768", None)
    return menu_hwnd != 0

def simulate_up():
    win32api.keybd_event(win32con.VK_UP, 0, 0, 0)
    win32api.keybd_event(win32con.VK_UP, 0, win32con.KEYEVENTF_KEYUP, 0)

def simulate_down():
    win32api.keybd_event(win32con.VK_DOWN, 0, 0, 0)
    win32api.keybd_event(win32con.VK_DOWN, 0, win32con.KEYEVENTF_KEYUP, 0)

def on_scroll(x, y, dx, dy):
    if is_unity_window() and is_context_menu_visible():
        if dy > 0:
            simulate_up()
        elif dy < 0:
            simulate_down()

# Create and start the listener
def main():
    print("Unity Context Menu Scroll Helper")
    print("Running... Press Ctrl+C to stop")
   
    # Create the listener
    with mouse.Listener(on_scroll=on_scroll) as listener:
        try:
            listener.join()
        except KeyboardInterrupt:
            print("\nStopping scroll helper...")

if __name__ == "__main__":
    main()




jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Desperate for Searchable Enum Drawer Integration in Playmaker [SOLVED]
« Reply #4 on: November 11, 2024, 06:20:02 AM »
Hi,

 woah, that's very interesting indeed! Sad it can't be done withing Unity directly...

Bye,

Jean