您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

35 行
1.2 KiB

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class MenuButton : MonoBehaviour
{
public bool defaultButton;
public bool ingameOption;
void Start()
{
if (defaultButton)
{
var gameOjectsWithEventSystems = FindObjectsOfType<EventSystem>();
if (gameOjectsWithEventSystems.Length > 0)
{
EventSystem eventSystem = gameOjectsWithEventSystems[0].GetComponent<EventSystem>();
if (!eventSystem.currentSelectedGameObject)
{
Debug.Log(string.Format("Activating {0} as currentSelectedGameObject on first Event System {1}", this.name, gameOjectsWithEventSystems[0].name));
eventSystem.SetSelectedGameObject(this.gameObject);
}
}
else
{
InputField inputField = GetComponent<InputField>();
if (inputField)
{
Debug.Log(string.Format("Activating {0} with ActivateInputField", this.name));
inputField.ActivateInputField();
}
}
}
}
}