Search Unity

Help with first UI attempt?

Discussion in 'Getting Started' started by Disc_Pistol, Jul 16, 2018.

  1. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    Hey guys, I'm Kieran. I'm still pretty new to Unity, studying it as part of a program in game-audio. I'm building a simple beat em up game, in the style of TMNT Arcade, or Simpsons arcade, and I wanted to include some onscreen text-based dialogue. I followed along with a few tutorials, and put together a scene to test out making textboxes. For my test scene, I followed this one pretty closely (
    ), but after putting it together, I am having a couple of problems.

    I have a text-question, with three buttons below representing different response options. However, when I play the scene none of the buttons are actually clickable. Nothing happens when I click on any of the buttons, when each should change the above text.
    Also, none of the buttons are highlighted, and moving my up/down, or hitting select does nothing. I want to make sure my game is playable on any generic 4 button controller/joystick. So I'd like the top response option to start as highlighted, and move the highlight with the up/down buttons, and I'd like to choose the option with the "select" button input, which I have mapped to a joypad button.

    None of the tutorials I have found have addressed this specifically. Should I be doing this with a script? In the animator? Any advice?

    thanks,
    -k
     
    Last edited: Jul 16, 2018
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Check that you have an EventSystem in the scene, and a Graphics Raycaster on your canvas.

    Normally these are added automatically when you create the buttons. But there are ways to accidentally remove them or not create them.
     
  3. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    Ok, thanks for that. I checked, and double checked, and I do have both a graphic raycaster, and an event system. So now I'm at the point where my buttons are clickable, and they do work as intended. However, until I make the first click, I get no control response from the controller. Weird part is, I can use the controller to change my selection up/down, and make a new button press after I click it first. Do you know how I can make the controller input work the first time?
     
  4. Disc_Pistol

    Disc_Pistol

    Joined:
    Jun 15, 2018
    Posts:
    23
    Ok, I finally figured it out. The event system has a field called "First Selected". Drag in your option 1 game object, and boom. Works like a charm.
     
    Kiwasi likes this.