Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Changing Button-Label through CheckSelection

Discussion in 'Immediate Mode GUI (IMGUI)' started by TemplateR, Mar 26, 2015.

  1. TemplateR

    TemplateR

    Joined:
    Mar 2, 2014
    Posts:
    21
    Hello,

    is it possible to change a button-label with the help of CheckSelection? I´m writing a Pause-Resume-Script for my little SideScroller-Game.
    First of all, I´m using Unity Free in the 4.5.1f-Version and I don´t intend to update it atm.

    I have created a "Levelmenu", where you have 3 buttons "Pause", "Resume" and "Main Menu", with the help of the Toolbar- and CheckSelection (Switch-Case)-Function.
    Now I wanted to have only ONE button for "Pause"- AND "Resume"-function and not sperated buttons. The pause- and resume-function itself with ONE button does works.

    The Problem is now the Lables of the Button. I want it so:
    Click "Pause" --->Game Paused--->Button-Label change to "Resume"
    Click "Resume" --->Game resumed----> Button-Label change to "Pause"
    and so on....

    Does anyone know, how to do it? I don´t really know and I don´t want to change the code it tooooo much.