- Home /
Question by
hemanthnaidu · May 19, 2020 at 04:11 AM ·
unity 2dhideflags
How to disable game object from the scene.
HI There i am new to unity and started basics while practicing i found an issue that is when i am trying to hide a game object using SetActive function from editor scene it is showing as hided but in real time scene it is still showing the object. And i have attached few screenshots for reference and script file that i am using to hide objects added here at the below.
// MainMenu
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class MainMenu : MonoBehaviour
{
public string firstLevel;
public Image optionsMenu;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void CloseOptions(){
optionsMenu.gameObject.SetActive(false);
}
public void OpenOptions(){
optionsMenu.gameObject.SetActive(true);
}
public void StartGame(){
SceneManager.LoadScene(firstLevel);
}
public void QuitGame(){
Application.Quit();
}
}
screen1.png
(210.3 kB)
screen3.png
(214.4 kB)
Comment