Question by
alias · Feb 24, 2016 at 07:11 PM ·
scripting problem
only menu1 hides on gui click
Hi i have a problem. with this code, if i click gui hide button only menu1 hides. and menu2 stays visible. can someone help me out?
using System.Collections;
using UnityEngine;
public class ShowHide4 : MonoBehaviour{
public GameObject Menu1;
public GameObject Menu2;
void OnGUI(){
if (GUILayout.Button("Hide"))
Menu1.SetActive(false);
Menu2.SetActive(false);
if (GUILayout.RepeatButton("Show"))
Menu1.SetActive(true);
Menu2.SetActive(true);
}
}
Comment
Best Answer
Answer by alias · Feb 29, 2016 at 09:52 AM
Fixed, kinda.
Just created an empty gameobject, moved menu1 and 2 under this new hierarchy. and renamed the empty gameobject menu1.
Your answer
Follow this Question
Related Questions
Best way to simplify this code 1 Answer
How can I avoid Input.GetKeyDown() being detected before it complete the iTween.MoveAdd() call? 2 Answers
Player movement help 1 Answer
CS0029 Error cannot implicity convert type 'bool' 'UnityEngine.Rendering.ShadowCastingMode' 1 Answer
Help with this code 1 Answer