Search Unity

How to disable DoozyUI button through code?

Discussion in 'Scripting' started by blastedw, May 8, 2019.

  1. blastedw

    blastedw

    Joined:
    Apr 29, 2019
    Posts:
    13
    I'm using DoozyUI and everything is working fine. Now I would like to disable/enable a UIButton through code. How can I achieve this?
     
  2. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    1,556
    Hmmm. Although I have use DUI before, I can't remember if they used anything non-Standard.

    To disable (meaning it's still therem but will not respond to clicks, and - if that Interface theme is used - will draw the inactive theme) a button, you usually use

    Code (CSharp):
    1. myButton.interactable = false;
    To make it disappear, use

    Code (CSharp):
    1. myButton.SetActive(false);
    -ch
     
  3. blastedw

    blastedw

    Joined:
    Apr 29, 2019
    Posts:
    13
    Thanks it works