Experimental: this API is experimental and might be changed or removed in the future.

ManipulatorActivationFilter

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。