Search Unity

Boolean Variable Used In Panel Buttons HELP.

Discussion in 'UGUI & TextMesh Pro' started by nstanchev16, Jun 5, 2019.

  1. nstanchev16

    nstanchev16

    Joined:
    May 27, 2019
    Posts:
    16
    Hi so I have a panel which contains 3 buttons.


    I created 3 Boolean variables for each button.

    I wanted to set each one to true if its consequent button was pressed.


    These are the methods assigned the the buttons.

    The problem is, after the panel is closes the variables go back to being false so I can't continue with my program. I added a debug.log to display 1 in console in the update method every frame if the Booleans are true, and this is how I realised as soon as panel closes they are no longer true. Any idea how to get the buttons in the panel to return a true value to my variables outside. Sorry I am a new programmer this may be a simple fix I just need to know asap.
     
  2. AlexandreT-unity

    AlexandreT-unity

    Unity Technologies

    Joined:
    Feb 1, 2018
    Posts:
    377