京城游戏人-Day13: 获取被点击的 Button 以及其上的文字内容

京城游戏人-Day13: 获取被点击的 Button 以及其上的文字内容

-

-

  • 获取被点击的 button:

    var button = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject
    
  • 获取 button 上的文字内容:

    Debug.Log(button.GetComponentInChildren<Text>().text);
    

-

-

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章