Home > OS >  How can I make title screen?
How can I make title screen?

Time:05-18

I am trying to make title screen when i press a button. It goes when i press the button game stops with Time.timeScale = 0f; and I am trying to do is when I click button time stops and two buttons shows up for quit and resume and I am trying to do when I press the button it sets show = true; in script for Menu button. This work but when I type script for button "resume" witch is:

private void Awake()
{
    gameObject.SetActive(false);
}
private void Update()
{
    show();
}
private void show ()
{
    if (show = true)
    {
        gameObject.SetActive(true);
    }
}

But there is an Error: Cannot assign to show because it is a method group. I don't know what this mean and how I can repair my code.

CodePudding user response:

it would be great if you made bool

here some example of your code

public bool show;

 private void Awake()
{
    gameObject.SetActive(false);
}

private void Start()
{
    show = false;
    gameObject.SetActive(false);
}
private void gameobject()
{
    if (show = true)
    {
        gameObject.SetActive(true);
    }
    else(show = false){
        gameobject.SetActive(false);
    }

      
        
}

Deleted show() and replaced update() with Start()

Useful information about bool

https://docs.unity3d.com/ScriptReference/30_search.html?q=bool source: unity documentary

  • Related