Custom UI Button Select

Updated on January 1, 2019 in [A] 2D
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on December 30, 2018

I want to make a select screen where when a button is selected, a notch appears like in old video games. Kind of like this: https://gamesremembered.files.wordpress.com/2014/01/rivercityransom_004.jpg. It helps make the buttons more interesting. Anyone have an idea of how I could go about doing this?

Thanks in advance.

  • Liked by
Reply
0 on December 30, 2018

My first idea is to create and place deactivated notch next to the button(every single button) inside of button prefab and then when the button is selected setting its notch object to active by script

  • Liked by
Reply
Cancel
0 on December 31, 2018

I can think of a few easier ways.

  1. Have your button sprite be totally transparent except for the arrow.  Then disable the button sprite unless the button is selected.
  2. I believe unity allows for handling selected buttons differently, so that you can just set it up in the UI as opposed to coding it yourself.
  3. Attach a separate image sprite (just the little arrow) to your button sprite prefab that gets enabled when the button is selected. So every choice will have an extra arrow image as a child of the choice button, but only one of them is enabled at a time.
  4. Only have one image sprite that floats between the various button choices by making sure that the anchors of the arrow sprite is set appropriately. You can have the anchors set to middle right of the button sprite, then set your origin of the arrow sprite to the middle right of the arrow sprite. Then you can just change the parent to whichever choice you want, the reset the ‘local’ position to zero again.
    Example: https://imgur.com/a/IE0c4GJ

Personally, I would do either 3 or 4. 

  • Liked by
Reply
Cancel
0 on January 1, 2019

Thanks, BinaryBeal! I think I understand what you mean.

  • Liked by
Reply
Cancel