struct in UnityEngine.Experimental.UIElements
切换到手册供操控器用于根据其要求匹配事件。
using UnityEditor; using UnityEngine; using UnityEngine.Experimental.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 | 如果当前鼠标事件满足激活要求,则返回 true。 |