您当前的位置: 首页 >  unity

云小川

暂无认证

  • 4浏览

    0关注

    78博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

unity Inputfield 回车或者tab换行

云小川 发布时间:2022-09-19 14:25:07 ,浏览量:4

 1.这个是几个InputField 换行

using LitJson;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class HTTPLogin : MonoBehaviour
{
    
    public InputField[] IfArray;//外部 拖拽 赋值
    private EventSystem es;
    
    void Start()
    {
       // Instance = this;
        es = EventSystem.current;
        es.SetSelectedGameObject(IfArray[index].gameObject, new BaseEventData(es));

       
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            index++;
            Debug.Log("index="+ index+ " IfArray.Length="+ IfArray.Length);
            if (index >= IfArray.Length)
            {
                index = 0;
            }
            es.SetSelectedGameObject(IfArray[index].gameObject, new BaseEventData(es));
        }
      
    }


   
   
}

2.一个InputField换行,按回车自动换行

 

关注
打赏
1663746399
查看更多评论
立即登录/注册

微信扫码登录

0.1302s