Legacy Documentation: Version 5.0
Language: English
  • C#
  • JS

Script language

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

Selectable.OnSelect

Switch to Manual
public function OnSelect(eventData: EventSystems.BaseEventData): void;

Parameters

eventDataThe EventData usually sent by the EventSystem.

Description

Set selection and transition to appropriate state.

#pragma strict
// Required when using Event data.
//Do this when the selectable UI object is selected.
public function OnSelect(eventData) {
	Debug.Log(this.gameObject.name + " was selected");
}