Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Trigger on Selected

Discussion in 'Input System' started by nogotogon, Feb 4, 2024.

  1. nogotogon

    nogotogon

    Joined:
    Sep 27, 2017
    Posts:
    4
    I'm currently working on UI and have a level select menu, I currently have it so that when you hover over a button it changes the text at the top of the screen to be the map description of the level the button's associated with (See Code Below) but as I'm trying to have the system work with controller input as well I'm using the Input system for controller controls and cannot find out how to have the description text change when selecting a button on the controller.

    Attached to the button
    Code (CSharp):
    1.     void IPointerEnterHandler.OnPointerEnter(PointerEventData eventdata)
    2.     {
    3.         mainmenu.ChangeMapDescription(mapData);
    4.     }
    Attached to the Menu Handler
    Code (CSharp):
    1.     public void ChangeMapDescription(MapData mapdata)
    2.     {
    3.         TextMeshProUGUI descriptionText = mapDescription.GetComponent<TextMeshProUGUI>();
    4.         descriptionText.text = mapdata.levelDescription;
    5.     }
     
  2. nogotogon

    nogotogon

    Joined:
    Sep 27, 2017
    Posts:
    4
    Having spent a little more digging I ended up finding the ISelectHandler.OnSelect routine to handle this issue.
     
  3. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,241