Selectable.FindSelectableOnDown

切换到手册
public UI.Selectable FindSelectableOnDown ();

返回

Selectable 位于当前对象下方的 Selectable 对象。

描述

查找此对象下方的可选择对象。

UI.Selectable.FindSelectableOnDown。

using UnityEngine;
using System.Collections;
using UnityEngine.UI; // required when using UI elements in scripts

public class Example : MonoBehaviour { public Button startButton;

// Disables the selectable UI element directly below the Start Button public void IgnoreSelectables() { //Finds the selectable UI element below the start button and assigns it to a variable of type "Selectable" Selectable secondButton = startButton.FindSelectableOnDown(); //Disables interaction with the selectable UI element secondButton.interactable = false; } }