You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
502 B
25 lines
502 B
9 years ago
|
using UnityEngine;
|
||
9 years ago
|
using UnityEngine.UI;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
8 years ago
|
/// <summary>
|
||
|
/// Select the UI element when the gameobject is enabled.
|
||
|
/// </summary>
|
||
8 years ago
|
[RequireComponent(typeof(Selectable))]
|
||
|
public class SelectOnEnable : MonoBehaviour
|
||
|
{
|
||
8 years ago
|
protected Selectable selectable;
|
||
9 years ago
|
|
||
8 years ago
|
protected void Awake()
|
||
8 years ago
|
{
|
||
|
selectable = GetComponent<Selectable>();
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
protected void OnEnable()
|
||
8 years ago
|
{
|
||
|
selectable.Select();
|
||
|
}
|
||
|
}
|
||
9 years ago
|
}
|