Search Unity

Adding a border to a button

Discussion in 'General Graphics' started by SimRuJ, Mar 16, 2018.

  1. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    I'm currently working on an options menu that has a couple of buttons: With 5 of them you can set the background color (black to white) and the others toggle other options like adding a coordinate system to the scene.

    I already set the "normal", "highlighted" and "clicked" colors for all the buttons (they all use the standard "UISprite") but what I now want to do additionally is:

    1. Give the button for the black background color (it's a narrow button UI object, no text) a white border, so you can actually see it, since the menus in my game have a simple, black background.

    2. If an option gets selected, I want to give the according button a red border that stays/gets re-enabled after re-opening the options menu - until the option is disabled again.

    Unfortunately the "Outline" component only seems to work with text. Is there another way to add a cheap border (in the UI for 1. and through a script for 2.)?

    I'm using version 2017.3.1f1.
     
    iamMohitG likes this.
  2. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    Anyone? :/