Version: 2020.1

ManipulatorActivationFilter

struct in UnityEngine.UIElements

切换到手册

描述

供操控器用于根据其要求匹配事件。

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 等)。

公共函数

MatchesChecks whether the current mouse event satisfies the activation requirements.