Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Selectable.FindSelectable

Switch to Manual
public function FindSelectable(dir: Vector3): UI.Selectable;

Parameters

dir The direction in which to search for a neighbouring Selectable object.

Returns

Selectable The neighbouring Selectable object. Null if none found.

Description

Finds the selectable object next to this one.

The direction is determined by a Vector3 variable.

#pragma strict
// required when using UI elements in scripts
public var direction = new Vector3(0, 1, 0);
public var btnMain;
public function Start() {
	//Finds and assigns the selectable above the main button
	var newSelectable = btnMain.FindSelectable(direction);
	Debug.Log(newSelectable.name);
}