Version: 2017.1

Selectable.FindSelectableOnLeft

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

返回

Selectable 位于当前对象左侧的 Selectable 对象。

描述

查找此对象左侧的可选择对象。

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

public class ExampleClass : MonoBehaviour { public Button btnMain;

public void Start() { //Finds and assigns the selectable to the left of the main button. Selectable newSelectable = btnMain.FindSelectableOnLeft();

Debug.Log(newSelectable.name); } }