Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Hide gui labels when you click on a button and show them when you click again

Discussion in 'Scripting' started by Barft, Jul 9, 2015.

  1. Barft

    Barft

    Joined:
    Apr 9, 2015
    Posts:
    84
    Hi all, i have a button that opens a canvas with some text labels and 3 buttons in it, in the scene with the button that opens the canvas i have made some text labels, but when you open the canvas the text labels from the scene are standing in front of the labels of the canvas, so you can't read the text labels in the canvas, so i came to the solution to hide the text labels in the scene when you click on the button to open the canvas, and if you click on one of the tree buttons,it will showing the text labels in the scene again. But how can i make this, i'm a beginner so i don't have many experience. Thanks!
     
  2. massey_digital

    massey_digital

    Joined:
    Apr 28, 2013
    Posts:
    94
    To hide gameobjects in the scene, use <GameObject>.SetActive(false) to hide objects and <GameObject>.SetActive(true) to show them again. <GameObject> is the object you intend to hide.

    Hope that helps!
     
  3. Barft

    Barft

    Joined:
    Apr 9, 2015
    Posts:
    84
    Alright, thanks man!