供操控器用于根据其要求匹配事件。
using UnityEditor; using UnityEngine; using UnityEngine.UIElements;
public class ClickableTest { public void CreateClickable() { var clickable = new Clickable(() => { Debug.Log("Clicked!"); }); clickable.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse }); clickable.activators.Add(new ManipulatorActivationFilter { button = MouseButton.RightMouse, clickCount = 2, modifiers = EventModifiers.Control }); } }
button | 用于激活操作的按钮。 |
clickCount | 激活操控器所需的鼠标单击次数。 |
modifiers | 激活操作所需的任意修改键(即,Ctrl、Alt 等)。 |
Matches | Checks whether the current mouse event satisfies the activation requirements. |