ボタンを選択状態にする

using UnityEngine.EventSystems;

選択状態にしたいゲームオブジェクトを設定する

EventSystem.current.SetSelectedGameObject(ゲームオブジェクト);

プログラム例

using UnityEngine;
using UnityEngine.EventSystems;
​
public class ButtonSelect : MonoBehaviour
{
    [SerializeField] GameObject button;

    void Start()
    {
        EventSystem.current.SetSelectedGameObject(button);
    }
}

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。