It is necessary when clicking on the "Main button" button, to change the Active of the "Home button" button (that is, to display and hide it). "Home button" - not nested in "Main button".

Since Unity has recently started learning, I can’t figure out how to turn to the "Home button" button, please help.

    1 answer 1

    Try this.

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class Buttons : MonoBehaviour { public GameObject MainButton; public GameObject HomeButton; public void HideMain(){ //скрываем кнопку Main MainButton.SetActive(false); HomeButton.SetActive(true); } public void HideHome(){ //скрываем кнопку Home MainButton.SetActive(true); HomeButton.SetActive(false); } } 
    • Damn ... Well, how could I not have guessed, I just can not get used to the logic of the Unity. I tried to somehow set everything through a variable or pick it up via a tag. 10 hours of sticking affect ... Thank you, help out! - DmitryDAN
    • @DmitryDAN if the answer was useful to you, please mark it with a solution and press the triangle up ("Answer is useful"), to the left of the answer - ThePyzhov